File To Blob Corruption

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I am trying to create an UPLOAD page to Update a Images and PDFs into a BLOB field in mySQL. The image keeps getting corrupted (it draws a portion of the image and the rest is GRAY) We tried it with Safari and Firefox with bad results.

Here is the form that is used to browse and select the file.

<!-- Upload Image dialog -->
<div id="uploadImage">
<div id="llback"></div>
<center><div id="uploadForm">
<div id="uploadTitle">Upload Thumbnail image</div>
<iframe name="saveImage"></iframe>
<b>Please select the thumbnail image, then press Upload.</b>
<div style="margin-top:14px;margin-bottom:14px;text-align:center;width: 100%"> <form target="saveImage" method="post" action="ajax/saveDialog.php" enctype="multipart/form-data"> Select Thumbnail: <input type="file" name="img" id="img" accept="image/ jpeg" /></div>
<input type="hidden" name="obj" value="uploadImage" />
<input type="hidden" name="id" value="<?php echo $Area_id ?>" />
<input type="button" value="Upload" onclick="saveDialog('uploadImage','img','jpg');"> <input type="button" value="Cancel" onclick="cancelDialog('uploadImage','img')">
</form>
</div></center>
</div>

Here is the QUERY to upload the image (saveDialog.php):

if($_POST['obj'] == "uploadImage") {
$file = $db->real_escape_string(file_get_contents($_FILES['img'] ['tmp_name']));
$db->query("UPDATE Areas SET Image = '$file'") or die("1".$db->error);

Has anyone else ever run into this type of UPDATE error with images and PDF? We really need to get this dealt with ASAP.

Thanks!

Don Wieland
D W   D a t a   C o n c e p t s
~~~~~~~~~~~~~~~~~~~~~~~~~
donw@xxxxxxxxxxxxxxxxxx
Direct Line - (949) 305-2771

Integrated data solutions to fit your business needs.

Need assistance in dialing in your FileMaker solution? Check out our Developer Support Plan at:
http://www.dwdataconcepts.com/DevSup.html

Appointment 1.0v9 - Powerful Appointment Scheduling for FileMaker Pro 9 or higher
http://www.appointment10.com

For a quick overview -
http://www.appointment10.com/Appt10_Promo/Overview.html


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux