On Sun, 2009-11-15 at 16:43 +1300, German Geek wrote:

> Hi, Could it have something to do with an eof character being encoded or
> something like that? Do you really need to store the files in the DB? It
> uses more processing power if stored in the DB because on retrieval, you
> have to unescape the string and return it. Modern filesystems are optimised
> better for files than databases and storing a filename and returning the
> contents is easier to implement than retrieving it from the DB...
> 
> http://forums.codewalkers.com/php-applications-45/upload-image-file-to-mysql-as-blob-849194.html
> 
> ++Tim Hinnerk Heuer++
> 
> http://www.ihostnz.com
> 
> 
> 2009/11/15 Don Wieland <d...@dwdataconcepts.com>
> 
> > 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
> > ~~~~~~~~~~~~~~~~~~~~~~~~~
> > d...@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
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >


Like someone mentioned on the link you posted; storing the images in the
database does offer a layer of security, as database access is far
easier to control than file access.

Thanks,
Ash
http://www.ashleysheridan.co.uk


Reply via email to