It seems to me that it would be easier to just escape all the characters
that are reserved... like, in Perl,
s/\\/\\\\/g;
s/\x0/\\0/g;
s/\'/\\\'/g;
I don't recall any others, you but you get my meaning... then you can just
pull it out in a select and use it immediately, without having to do any
translation or uudecoding.
---
tani hosokawa
river styx internet
On Tue, 27 Apr 1999, Philippe wrote:
> John Craig wrote:
>
> > don't know if it's the best way to do it, but seems to work OK.
> >
> > $fp = fopen('big.file.jpg', 'r');
> > $jpg = fread($fp, filesize('big.file.jpg));
> > fclose($fp);
> > $db->query("update table set blob_field = '".base64_encode($jpg)."' where
> > ...
> >
> > JC
>
> Ok Thanks, but is it possible to combine this with the upload method in
> order to upload directly a file from outside into the blob ?
>
> the upload method is :
>
>
> <?php
> /* Handle multiple file upload easily */
> /* by Ronny Haryanto <giant@stripped> */
> /* February-ish 1999 */
>
> /* Use it however you want. I'm not responsible for what you do with it. */
>
> /* how many upload slots? */
> define( "UPLOAD_SLOTS", 5);
>
> /* where to move the uploaded file(s) to? */
> define( "INCOMING", "/home/ronny/incoming/");
>
> if($REQUEST_METHOD!= "POST")
> {
> /* generate form */
> echo "<form enctype=\"multipart/form-data\" method=post>\n";
> for($i=1; $i<=UPLOAD_SLOTS; $i++)
> {
> echo "<input type=file name=infile$i><br>\n";
> }
> echo "<input type=submit value=upload></form>\n";
> }
> else
> {
> /* handle uploads */
> $noinput = true;
> for($i=1; $noinput && ($i<=UPLOAD_SLOTS); $i++)
> {
> if(${ "infile".$i}!= "none") $noinput=false;
> }
> if($noinput)
> {
> echo "error uploading. create 150MB coredump instead?";
> exit();
> }
> for($i=1; $i<=UPLOAD_SLOTS; $i++)
> {
> if(${ "infile".$i}!= "none" &&
> copy(${ "infile".$i}, INCOMING.${ "infile".$i. "_name"}) &&
> unlink(${ "infile".$i}))
> {
> echo ${ "infile".$i. "_name"}. " uploaded<br>";
> }
> }
> } /* else */
> ?>
>
> Thanks,
> Philippe.
>
>
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail mysql-thread2474@stripped
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail mysql-unsubscribe@stripped instead.
>