LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-30-2010, 10:01 AM   #1
t0bias
Member
 
Registered: Aug 2005
Distribution: Fedora 13, RHEL 5.3, Ubuntu 10.04, Debian Lenny
Posts: 128

Rep: Reputation: 16
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
 
Old 10-15-2010, 08:46 AM   #2
wclark
LQ Newbie
 
Registered: Aug 2007
Posts: 6

Rep: Reputation: 0
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Uploaded file using PHP scripts are getting deleted of it's own jitender.ind Linux - Server 3 08-10-2009 01:26 PM
PHP validation of uploaded WAV file Spudley Programming 1 12-16-2008 05:27 PM
Can not insert word file into mysql table (in blob field) prabhatsoni Linux - Software 2 07-21-2006 05:01 AM
get full path of uploaded file in php spoody_goon Programming 2 05-10-2005 07:32 PM
php only runs when file is called directly pnh73 Linux - Networking 2 02-20-2004 11:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration