Hi,

I have created a simple script to upload file. It's not working. Shows error code 7.

I am running the script on CentOS. I have given full permissions (777) on upload temporary, final folders, even on the script file.

Temporary upload folder set through php.ini

Script has all required parameters like enctype="multipart/form-data" etc.

Please help.

Thanks,
Sandeep

    Error code 7 is UPLOAD_ERR_CANT_WRITE:

    Value: 7; Failed to write file to disk.

    If you've given 777 permissions, you may want to add some debug statements to your file manipulation code to make sure you're not running into relative file location issues.

      Wynder;11024307 wrote:

      If you've given 777 permissions, you may want to add some debug statements to your file manipulation code to make sure you're not running into relative file location issues.

      None of the "file manipulation code" is relevant - if you're getting error 7, it means PHP couldn't write to the upload directory before it ever started executing any of your script.

      @: I'm wondering if the 0777 (not to be confused with 777 decimals 😉) permissions were given on the directory that PHP is attempting to use. Have you done a [man]phpinfo/man to confirm that this directory is indeed where you expect it to be?

        5 days later

        Thanks for the response.

        Yes, I have checked phpinfo and I have given 777 permissions on respeective directory. But, I am wondering if this issue is related to CentOS or AWS (Amazon cloud services). I have set up websites earlier on different hosting service like GoDaddy, DailyRazor etc. But, I never faced such issue.

        Thanks,
        Sandeep

          Write a Reply...