开发者

input hidden value limit in html

I am trying to put an entire 20kb jpg file content in input hidden value, but when I receive the data I only get 4kb file. What is the problem ?

I am using the following code to read jpg from a server and upload to another server.

<?php
$filename = "filetocopy.jpg";
$filedata = file_get_contents($filename);
file_put_contents("filetocopy1.jpg", $filedata);
echo "<!DOCTYPE HTML PUBLIC \"-//W3C开发者_运维百科//DTD HTML 4.0 Transitional//EN\"><html><head><title></title>";

echo "<script LANGUAGE = "."Javascript"." type"."test/javascript".">";

echo  "function doSubmit() {";
    //alert('function called.');
echo    "document.forms[\"postjsform\"].submit();";
echo "}";

echo "</script>";

echo "</head>";

echo "<body onload='doSubmit();'>";

echo "<!-- Start of FORM -->";
echo "<form id=\"postjsform\" action=\"postjs2.php\" method=\"POST\">";
echo "Hidden Data: <input type=\"hidden\" name=\"hiddendata\" value=" . $filedata . ">";
echo "<br>";
echo "</form>";
echo "<!-- End of FORM -->";

echo "</body></html>";

?>


Since you didn't post any HTML for the form, I imagine the problem is there.

For example, you could be using method="get" instead of method="post" and be running into an URL length limitation.

Two things I am certain of here: Something is truncating your data, and it's not your PHP.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜