views:

181

answers:

3

This may not be possible, but I'd like to ask anyway and see if there's a creative solution out there.

I'd like to have a "file" form field on my site that uploads a file into a BLOB field in a MYSQL database. I must use PHP to accomplish this task.

Normally, I know you would open the temp file found in the $_FILES array, using fopen(), then add the data to the db that way. In this case however, the fopen() function, and pretty much all other file handling functions (file_get_contents, etc) are disabled in php.ini.

Is there a way to get the file data from the HTTP post and put it into the MYSQL database without relying on the file handling functions built into PHP?

P.S. shell_exec is also disabled

+1  A: 

If you have access to the $HTTP_RAW_POST_DATA variable, , then you should be able to parse out the file data manually.

Remy Lebeau - TeamB
Care to add example code to demonstrate how one might do this?
Nerdling
From the manual: $HTTP_RAW_POST_DATA is not available with enctype="multipart/form-data".Is there a way to get a file's contents to show up in $HTTP_RAW_POST_DATA?
Travis
I did not see that comment in the documentation.
Remy Lebeau - TeamB
A: 

this link will help you : http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/uploading-files-to-mysql-database.aspx

bader
This tutorial is using fopen() to open the temp file from $_FILES, which is not possible in this scenario. This is typically the correct approach for loading uploaded files into MySQL though.
Travis
A: 

without fopen or file_get_contents you cant upload any file to your database .. why you don't try ftp functions (fput ,etc) ??

bader