yami007 Posted September 17, 2009 Share Posted September 17, 2009 here is the issue i want to check if the user has set the file upload or not this way <?php if(isset($_POST['image'])) { // process the upload } ?> but it's not working at all so what do i have to do?? Quote Link to comment https://forums.phpfreaks.com/topic/174581-solved-what-should-i-do-with-file-_postimage/ Share on other sites More sharing options...
Garethp Posted September 17, 2009 Share Posted September 17, 2009 $_FILES['image'] http://www.tizag.com/phpT/fileupload.php Quote Link to comment https://forums.phpfreaks.com/topic/174581-solved-what-should-i-do-with-file-_postimage/#findComment-920066 Share on other sites More sharing options...
Bricktop Posted September 17, 2009 Share Posted September 17, 2009 Hi yami007, You can't check for a file upload with the $_POST parameter, use is_uploaded_file instead and/or $_FILES instead. http://us3.php.net/manual/en/function.is-uploaded-file.php http://us.php.net/manual/en/reserved.variables.files.php Hope this helps. Quote Link to comment https://forums.phpfreaks.com/topic/174581-solved-what-should-i-do-with-file-_postimage/#findComment-920068 Share on other sites More sharing options...
Zane Posted September 17, 2009 Share Posted September 17, 2009 file uploads are stored in the $_FILES superglobal... (instead of $_POST) it looked like this on the inside The format of this array is (assuming your form has two input type=file fields named "file1", "file2", etc): Array ( [file1] => Array ( [name] => MyFile.txt (comes from the browser, so treat as tainted) [type] => text/plain (not sure where it gets this from - assume the browser, so treat as tainted) [tmp_name] => /tmp/php/php1h4j1o (could be anywhere on your system, depending on your config settings, but the user has no control, so this isn't tainted) [error] => UPLOAD_ERR_OK (= 0) => 123 (the size in bytes) ) [file2] => Array ( [name] => MyFile.jpg [type] => image/jpeg [tmp_name] => /tmp/php/php6hst32 [error] => UPLOAD_ERR_OK => 98174 ) ) Quote Link to comment https://forums.phpfreaks.com/topic/174581-solved-what-should-i-do-with-file-_postimage/#findComment-920069 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.