Jump to content

php safe mode and uploading images


thakerm

Recommended Posts

 

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.