[PHP] Re: Store uploaded files in MySQL-BLOB
I would suggest setting the database column to LONGTEXT instead of BLOB since it can accomidate far more characters per entry. As for the entry to the database through php, I'm not entirely sure what method you're using to add these. Are they uploading their file and then it reads it as it exists on the server? Is it supposed to read a file they specify with a browse but never actually upload it anywhere? It might be better to just include a text field for them to cut+paste to in a form if it's nothing but text. -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP] Re: Store uploaded files in MySQL-BLOB
- Original Message - From: Adam [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 10, 2001 12:20 PM Subject: [PHP] Re: Store uploaded files in MySQL-BLOB I would suggest setting the database column to LONGTEXT instead of BLOB since it can accomidate far more characters per entry. As for the entry to the database through php, I'm not entirely sure what method you're using to add these. Are they uploading their file and then it reads it as it exists on the server? Is it supposed to read a file they specify with a browse but never actually upload it anywhere? It might be better to just include a text field for them to cut+paste to in a form if it's nothing but text. -Adam The project is a kind of knowledge base. For each entry a user creates, he should be able to give additional information, such as every kind of file (i.e. not only code files but also images etc). There is an input type=file ... where he selects the file to be uploaded. The php-script is simply supposed to receive the file and put it into the proper database-column (which is a MEDIUMBLOB by the way, should be enough space, or what's your opinion?). Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: PHP] Re: Store uploaded files in MySQL-BLOB
The project is a kind of knowledge base. For each entry a user creates, he should be able to give additional information, such as every kind of file (i.e. not only code files but also images etc). There is an input type=file ... where he selects the file to be uploaded. The php-script is simply supposed to receive the file and put it into the proper database-column (which is a MEDIUMBLOB by the way, should be enough space, or what's your opinion?). in my opinion you'd save yourself some major hassle by allowing them to ftp files like this directly to a server's directory via form based ftp. then perhaps add a column that adds filenames to itself with the UPDATE sql query type. this should be enough info for you to write php that could handle a listing of these dynamicly. I'm still not entirely sure the details but this is what I would do in the same situation. A db engine is for text, a server is for storing files. IMHO -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Store uploaded files in MySQL-BLOB
Tom, First, I suggest using LONGBLOB as a field... Second, Once the $userfile is uploaded...use the statment as: $query = INSERT INTO ... (file) VALUES ( LOAD_FILE($userfile)); using the MySql's LOAD_FILE() Tom Gitzinger [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi friends, could anybody tell me how I best store one or several uploaded files in a MySQL database (as a BLOB). I use PHP 3. Let's say I have the variable $userfile. Is it possible to simply insert this into the database? $query = INSERT INTO ... (file) VALUES ( . $userfile . ); By the way: which version of PHP 3 do you need to upload several files at once? Tom -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net GMX Tipp: Machen Sie Ihr Hobby zu Geld bei unserem Partner 11! http://profiseller.de/info/index.php3?ac=OM.PS.PS003K00596T0409a -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]