Re: file upload

From: Date: Thu, 15 Apr 2004 16:32:43 +0000
Subject: Re: file upload
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-183484@lists.php.net to get a copy of this message
Tony (I'm guessing) -- ..and then Anthony Ritter said... % % In the following snippet, which uploads binary files to a mySQL database it % works fine when Register Globals are set to ON. .. % $data = addslashes(fread(fopen($form_data, "r"), filesize($form_data))); This line is important to note. % % $result=mysql_query("INSERT INTO binary_data % (description,bin_data,filename,filesize,filetype) ". % "VALUES % ('$form_description','$data','$form_data_name','$form_data_size','$form_data % _type')"); You use $data here because you created it; good enough. % .. % However, when I turn the Register Globals to OFF and insert a $_FILES[ ][ ] % array for the form variables such as: % % ----------------- % % $data = addslashes(fread(fopen($_FILES[form_data], "r"), % filesize($_FILES[form_data]))); % % and % % "VALUES % ('$_FILES[form_data][form_description]','$_FILES[form_data][data]','$_FILES[ % form_data][form_data_name]','$_FILES[form_data][form_data_size]','$_FILES[fo % rm_data][form_data_type]')"); % ----------------- Even though you're still creating $data you're now trying to send $_FILES[form_data][data] as a value and I don't know what that is at all :-) Change that back to $data and you should be fine. % % The file does not get uploaded. % % Any assiatnce will be greatly appreciated. % Thank you. % TR HTH & HAND :-D -- David T-G davidtg@justpickone.org http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

« previous php.general (#183484) next »