Re: Very Large MySQL Query String
| From: | Julio Nobrega Trabalhando | Date: | Mon, 06 May 2002 13:52:56 +0000 |
| Subject: | Re: Very Large MySQL Query String | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96249@lists.php.net to get a copy of this message | ||
Instead of uploading to Mysql, why don't you store the file at a directory
and on Mysql only the path to it?
Retrieving files from the hard drive is much faster than doing the same on
Mysql, and also access to manipulation (insert, update, delete, etc...)
--
Julio Nobrega.
Um dia eu chego lá:
http://sourceforge.net/projects/toca
Ajudei? Salvei? Que tal um presentinho?
http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884
"David Bouw" <maillist@mubo.nl> wrote in message
news:63458.213.73.175.215.1020687730.squirrel@login.mubo.nl...
> I can't seem to figure out the following.
>
> I use the http upload functions a lot, works great!!..
> For some months now I have been using a small PHP program
> which I use to upload PDF files of scanned documents and
> insert them into a Mysql table..
>
> Normally these files are small (<250 kb), but I now have a
> PDF of 1 MB... When uploading files I run the
> function: chunk_split(base64_encode($binaryfile));
> to encode it, this to transform the binary file to text.. (Works great!!!)
>
> When the query was called to insert the data, nothing happens,
> also no error from mysql... Only think I can think of is that the mysql
> query string is to long.. ?? (The data when encoded is about 1.3 MB of
> text)..
>
> This is the source code..
>
> if (!($userfile_size == 0))
> {$fd = fopen ($userfile, "r");
> $contents = fread ($fd, filesize ($userfile));
> fclose ($fd);
> unlink ($userfile);
> echo "Eerste RAW: ".strlen($contents);
> $encodes_data = chunk_split(base64_encode($contents));
> $userfile_name = str_replace(" ", "", "$userfile_name");
> echo strlen($encodes_data)." - Displays text size <BR>"; //Works
right!
> mysql ($databasename_boekhoud, "insert mubo_boekhoud_images (data,
> originalname, groep, type)
> values '$encodes_data', '$userfile_name', '$groep',
> '$userfile_type')");
//
> mysql_error(); //No error given..?
> }
>
> Any suggestions are very much appreciated...
>
> With kind regards,
> David Bouw
>
>