apache - Handle HTTP POST with PHP -
i struggled half day , came conclusion can't done. threw away php scripts , rewrote in perl , worked right start way wanted work. still, want find out if such trivial task can done correctly in php. question: have arbitrarily long (in size , time) file upload (via raw data post) , need save file php. way works php fist processes posted data, saves file , execution of script begins (my file upload lasts 30 minutes). if tried fopen("php:/stdin" or php://input) still worked retarded way. need able process incoming posted data in chunks sequentially. tried: 1) modphp, 2) php-cgi, 3) php-cli run cgi executable. though php-cgi meant used cgi, still preprocesses posted data (so $_post becomes available) , doesn't work same way regular momphp. cli version run cgi script doens't work, can't read php://stdin or php://input @ all! whatever tried, nothing worked me , came conclusion can't done php... or can?
thanks
of course php can it. uploaded files stored in temporary directory until php script can interact them. information necessary in $_files
array.
$field_name = 'file'; # html form control $move_result = move_uploaded_file( $_files[$field_name]['tmp_name'], $real_destfile ); if ($move_result) { print "successfully uploaded file (originally called '$_files[$field_name]['name']' $real_destfile"; } else { print "failed receive uploaded file."; }
Comments
Post a Comment