windows server everytime upload a image need to set manually permission to full control to read the image with URL, how to fix this issue to not everutime set permission after upload an image. i'm using laravel public folder to upload. folder structure is. public/user/image.jpg
my web.config file is in public folder
after image upload when i manully set the folder permission to full control, then the image load properly in public url. but by default its returns 500 error
A 500 error is thrown when your server has incorrect file permissions. When you open the detailed error, it is also known as HTTP Error 500.50 – URL Rewrite Module Error.
The problem occurs because PHP first uploads the document to a temporary directory (default is C:\Windows\Temp) and then moves it from that directory to the actual destination.
Since IIS does not have any permissions on C:\Windows\Temp
, when the file is uploaded and moved, the file will not inherit any permissions. So when IIS tries to serve the file from the uploads folder, it throws an error 500, which is actually a permissions error.
SOLUTION:
Grant Modify/ Read & Execute/ List Folder Contents/ Read permissions to IUSR
and <server>\IIS_USRS
on C:\Windows\Temp
, and enable inheritance on the c:\windows\temp
folder.
Once that is done, files uploaded and moved will have the correct permissions, and will be served without error.