thakerm Posted August 18, 2007 Share Posted August 18, 2007 PHP v. 4.4.2 Hey yall, I am trying to upload an image to my school server, however it is in safe mode. I am developing a webpage for a club and would like to be able to upload images using a single php script. I have searched around and want to make sure if it is even possible to upload in safe mode with PHP version 4.4.2. This is the code I currently have: $uploaddir = "upload/"; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir.$_FILES['userfile']['name'])) { echo "file uploaded"; } else { echo '</br>'; echo "error!"; echo '</br>'; echo $_FILES['userfile']['error']; echo '</br>'; } I have set all the right permissions to the upload folder and I know my form is right. I got the form code by searching google and referencing a php book I have. By the way, the error I get when I try and upload something is 0. Hope you guys can shine some light on this for me. Thanks thakerm Quote Link to comment https://forums.phpfreaks.com/topic/65548-php-safe-mode-and-uploading-images/ Share on other sites More sharing options...
cooldude832 Posted August 18, 2007 Share Posted August 18, 2007 is your form multi/type data? also do print_r on the errors not echo Quote Link to comment https://forums.phpfreaks.com/topic/65548-php-safe-mode-and-uploading-images/#findComment-327287 Share on other sites More sharing options...
thakerm Posted August 19, 2007 Author Share Posted August 19, 2007 Yes the form is using multi part data. And I tried using print_r and it gives me this: "file uploadedArray ( [userfile] => Array ( [name] => oic.jpg [type] => image/jpeg [tmp_name] => /var/tmp/phpsbai8m [error] => 0 => 16904 ) )" Thanks Quote Link to comment https://forums.phpfreaks.com/topic/65548-php-safe-mode-and-uploading-images/#findComment-327887 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.