Dear Javier,

Yes, indeed when you encode the file it grows. Normally about 30%..
Thus, the file in my situation of 1 Megabyte grows to 1.3 MegaByte..

But I would expect that this should not give any problems...
The columns I am using allows 16 Megabyte.. Does anyone else know what
the string limitation of PHP Mysql query function is?

With kinds regards,
David Bouw

> Hi, I think if you encode the file with base64 and store it in the
> database the size of the document will be more than 1MB sure.
>
> David Bouw wrote:
>> Dear Kirk (and Julio)
>>
>> Thanks for the response..
>>
>> I don't want to use a link to the images because backing up my data
>> and porting it to another machine is much easier. (Replicating is also
>> very easy.) When storing the file separately this gets more complex,
>> especially when you want to get this data from another machine...
>>
>> The stored data isn't retrieved very often, so speed isn't really an
>> issue. (Till now speed really never was an isse. When adding the right
>> indexes MySql + PHP does incredible things!!.)
>>
>> I do though use the suggested 'linking' method for an website where
>> the images are needed on the website.. In the current situation though
>> I store PDF images of invoices which are basically only needed to look
>> something up if there is a problem...
>>
>> Kirk, I already tried changing the properties of the column in which I
>> store the images.. (Currently it is an longtext, but before this I
>> always used an Longblob...)
>>
>> I can't remember the exact sizes of MySQL, but I believe that an
>> Mediumblob can handle 16 Megabyte..  (I know have little more than a 1
>> MB..)
>>
>> I will try some things tomorrow, but I can't find out what the problem
>> is.. (Column size, PHP-Mysql string length limitation or maybe
>> something I am overlooking..)
>>
>> I can though echo the query to screen and see that the uploaded file
>> is encoded to a very nice (large) text-string..
>>
>> Any other suggestions are greatly appreciated.
>>
>> With kind regards,
>> David Bouw
>>
>>
>>
>>
>>
>>>If I use the link to the file, i.e.
>>>
>>>   file//C:\filedir\file.pdf or .txt or whatever
>>>
>>>how do I  insert/update/delete the file since MySQL is holding only
>>>the link?
>>>
>>>BTW David, what are the properties of the field you are inserting to?
>>>Could that be the problem?
>>>
>>>-Kirk
>>>
>>>"Julio Nobrega Trabalhando" <[EMAIL PROTECTED]> wrote in message
>>>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>>>
>>>>  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" <[EMAIL PROTECTED]> wrote in message
>>>>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>>>>
>>>>>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
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>>--
>>>PHP General Mailing List (http://www.php.net/)
>>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to