Jump to content

Recommended Posts

So my PHP can't upload files through a form. tmp_name is empty, and the file isn't being created in the specific temp directory (from php.ini). Has anyone resolved this issue before? I've done alot of googling but cannot find a fix, despite the number of posts out there concerning this issue...

 

 

Link to comment
https://forums.phpfreaks.com/topic/162286-php-cant-upload-files-through-form/
Share on other sites

And why do you think this is a IIS problem ?

 

I'll move this to the PHP help, but also you will need to post your form and PHP code..

the problem is likely in the form, check the METHOD is POST and the ENCTYPE is multipart/form-data

OK update. This error is occuring on my local setup. The exact code works on my live setup but is showing a move_uploaded_file error. ) probably unrelated)

 

So the form is fine, the php code is fine. It's some whacked out IIS permission error.

 

 

Would you like to share the error?

 

here is a quick todo.

 

1) Once you have created subdirectories "uploads/"  in the same directory wher you code is running use the code from oportocala above and to make absolutely sure sure that the file you are trying to right is written under that folder. ( I recomend printing it using echo $uploadfile; )

 

2) In windows explorer browse to the upload directory created above and share it. To do that execute the following substeps.

    a) Right click the folder click "sharing and security..."

    b) Check 'Share this folder on the network'

    c) Check 'Allow network users to change my files' ( THIS STEP IS VERY IMPORTANT )

    d) click 'ok' or 'apply'

 

3) you can then go in the IIS to set read and write permissions for it. To do that execute the followin substeps.

    a) Open IIS (Start/Controp Panel (classic View)/ Admistrative tools/Internet Information Service

    b) Browse to your folder (the one we created above)

    c) right click and select properties.

    d) in the Directory tab, make sure, READ, WRITE, AND DIRECTORY BROWSING are checked.

    e) For the security freaks out there, You should also make sure that 'execute permissions:' are set to Script only or lower (DO NOT SET IT TO 'script and executable)'( that is because someone could upload a script to your directory and run it. And, boy, you do not want that to happen).

well there's no error on my local machine.

 

if(move_uploaded_file($_FILES["1"]['tmp_name'], $_FILES["file"]["name"])) is not firing.

 

tmp_name is blank

tmp_Error is 0

 

I've set the tmp file upload folder in php ini and set all permissions on for all users ( including IIS user ) and the file is not being created in there.

 

---

 

The error on the active server is: (unrelated)

 

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpK20iIC' to '' in /home/content/b/a/c/baconbeastnz/html/top_php.php on line 313

 

 

EDIT: Am trying the stuff you quoted in. thanks for that! will get back to you soon.

Ahya! Haha thanks. That was pretty tired, think I have been coding too long today. Once you past 8 hours things start to slow down lol.

 

So now its working on the live site!! Hmm I'll try and fix it on the local site and post the Solution and label it solved

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.