LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   PHP: put uploaded file directly to mysql blob (https://www.linuxquestions.org/questions/linux-server-73/php-put-uploaded-file-directly-to-mysql-blob-835422/)

t0bias 09-30-2010 10:01 AM

PHP: put uploaded file directly to mysql blob
 
Hi,

I am trying to read a file uploaded by a simple <input type="file"> form and directly write it to a mysql blob - without saving it to the filesystem.
I tryed something like:
Code:

$input = fopen("php://input", "r");
$temp = array();
stream_copy_to_stream($input, $temp);
fclose($input);

it writes some few Bytes to the DB and there is no error, but it's not the actual file that is being written. Any ideas?

Thanks,

Toby

wclark 10-15-2010 08:46 AM

It is extremely bad coding to do this.
google for php file upload and you will find the php doc page that tells how to correctly do this without security issues.


All times are GMT -5. The time now is 10:30 AM.