File To Blob Corruption

From: Date: Sun, 15 Nov 2009 01:39:20 +0000
Subject: File To Blob Corruption
Groups: php.general 
Request: Send a blank email to php-general+get-299835@lists.php.net to get a copy of this message
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@dwdataconcepts.com 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

« previous php.general (#299835) next »