hi
I'm running PHP4, MySQL + Apache 1.3XX on W2K.
I'm attempting to insert an image via 'POST' from an HTML form directly into a longblob-field in MySQL.
It works fine on my PC, but on my Laptop it distorts/truncates the image -- (but the size the img occupies seems to be correct.)
this is the HTML code
<form enctype="multipart/form-data" action="<?=$PHP_SELF; ?>" method="post">
<input type="file" name="userfile" size="40">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<input type="hidden" name="send" value="yes">
<input type="submit" value=" upload ">
</form>
this the PHP code
if (is_uploaded_file($userfile))
{
//open/read in the uploaded file
$fileContent = fread(fopen($userfile, "r"), filesize($userfile));
//escape special chars
$fileContent = addslashes($fileContent);
$query = "insert into images (data) values" . "('$fileContent')";
if (mysql_query($query, $connection))
echo "file received !!!";
}
any comments/help - possible solutions appreciated
thx
m