Hello all!

I'm trying to make a local copy of my website (using IIS, installed PHP, mySQL, etc.) and am running into file upload errors.

When I do print_r($_FILES) after uploading the file, I get the following:

Array ( [uploadedfile] => Array ( [name] => test.doc [type] => [tmp_name] => [error] => 6 [size] => 0 )

So, error 6, which after some research I figure out means I am missing a temp folder in which to store uploaded files before they are saved to their final destination. So I go in my php.ini file and locate upload_tmp_dir and see it is blank. I set it to " C:\inetpub\wwwroot\uploads" and create the \uploads folder and give it appropriate permissions, expecting this to fix the problem, but no luck, I still get error 6...

Is there something else I need to fix in php.ini? Or is this an invalid way to reference that folder? Or does it need to be another folder?

Thanks...

    here is what i found on php's web site http://www.php.net/ini.core

    So you default system temp directory is not writeable by the IIS user. find that directory and give it write permissions for that user OR make a new directory, set it in php ini and give that directory write permissions for the IIS user

    I think 🙂

    Hope it helps,
    Joe

    Here's a short explanation of the configuration directives.

    file_uploads boolean

    Whether or not to allow HTTP file uploads. See also the upload_max_filesize, upload_tmp_dir, and post_max_size directives.
    When an integer is used, the value is measured in bytes. You may also use shorthand notation as described in this FAQ. 

    upload_tmp_dir string

    The temporary directory used for storing files when doing file upload. Must be writable by whatever user PHP is running as. If not specified PHP will use the system's default.

    upload_max_filesize integer

    The maximum size of an uploaded file.
    When an integer is used, the value is measured in bytes. You may also use shorthand notation as described in this FAQ. 
      1. Do a phpinfo() and tell us what it says for the temp dir - does it reflect your change? Also, if it does, double check the path (just to make sure the directory is where you think it is).

      2. What permissions did you give this directory?

        thanks redrage for your reply. that doesn't solve the problem though...

        i know about the "upload_tmp_dir" php.ini setting. And I set it to: "\uploads" which I then created. Not knowing where to create it, I put one both in my \wwwroot folder and one in the folder in which php.ini resides (C:\Windows). I then gave all users full control permissions (I'll be more restrictive later).

        And yet it still doesn't work. This is where I'm stuck.

        Any ideas? Are my not created the "\uploads" folder in the right directory? Do I need to point to its full address in php.ini instead of this shortened form (I tried the full address, C:\inetpub\wwwroot\uploads actually, with no success)?

        Any ideas? THanks.

          Yes, you need to use the full path.

          PHP resides on the server and accesses files on the local file system. Thus, if you tell PHP to navigate to "\uploads", it understands that as the 'uploads' folder in the root of the drive, e.g. c:\uploads.

          Also, what do you mean by "all users" ? Do you mean you added the local "Everyone" group and check the 'Full Control' box?

            hey that worked! i'm sure i tried that before though... hmm, goes to show, better to check twice.

            thanks for your help.

            btw - yes at the moment i checked full control for "everyone". i will go back and change that though - tinker with it.

              In case you didn't know how; you can restrict the permissions so that only the IUSR_(ServerName) account has permissions to write to that directory (well, minus domain admins and such! :p). Note that this is on a default IIS installation; if someone's reconfigured the IIS process to run as a different account, you'd have to find out what account that is.

              Also, don't forget to mark this thread resolved.

                hello bradgrafeman
                i am have similar problem with upload_file_dir just as fold025. i am using iis 7 on vista. i have try both the full path(C:\inetpub\wwwroot\uploads) and short path(C:\uploads\ and none is working, i have change premission to full and it is still not working.

                please, please i need your help, i have try very thing and nothing is working,

                  np1015683 wrote:

                  i have try both the full path(C:\inetpub\wwwroot\uploads) and short path(C:\uploads\ and none is working

                  I don't understand what you mean... one isn't the 'long' and one the 'short'... it's more like, one of those is the 'correct' path and one is the 'incorrect' path. Which one is correct?

                  Once you determine that, do a phpinfo() and see if PHP reflects the changes you've made to the php.ini file. Does it?

                    no it does not show the changes......do you know why

                    upload_max_filesize 2M 2M
                    upload_tmp_dir no value no value
                    user_dir no value no value

                      the correct path is C:\inetpub\wwwroot\uploads

                        5 months later

                        my problem is quite similar to foid25,
                        earlier i was not able to configure the php.ini n set the upload_tmp_dir,
                        later i was able to do so and verified too that it was changed,

                        the problem now is:
                        i m using vista with xampp installed on it and all was working very well

                        but when i switched to the main college server (freeBSD system) i was not able to get the correct result,i copied the php.ini-recomemded to php.ini and made the necessary changes and restarted the apache server ,but the code that was working properly earlier started to behave abnormally,,

                        can you tell me how to configure php.ini for the freeBSD system,without forgetting that i dont know much about the bsd systems
                        plz help me out

                          Write a Reply...