note 44980 deleted from function.chunk-split by aidan
| From: | aidan@php.net | Date: | Sun, 22 Aug 2004 11:16:03 +0000 |
| Subject: | note 44980 deleted from function.chunk-split by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75088@lists.php.net to get a copy of this message | ||
Note Submitter: Craig at chatspike dot net
----
This function is great if you plan on doing large MySQL inserts with a small buffer size, i wont
include a sample script, but i'll explain how it would work..
You take your large file.. chunk_split it (Ensuring that you use the right data size), with a char
which WONT appear in the file (your might wanna base64_encode the file first..(will also cut down on
'addslashes' problems)), once this is done, you can explode() the data, based on your
seperation char, create an empty record in the MySQL database, get the id of it using
mysql_insert_id(), then create a for loop which performs something like "UPDATE files SET
contents = concat('$buffer') WHERE id = '$blah';" on each of the segments..
Hope this is understandable, and helps people out.