Why dont i have rights on uploaded file?
I've just created a php snippet that allows me to upload pictures. Im开发者_运维知识库 working on my personal pc that runs Windows7, IIS7 and PHP.
The wierd thing is that Im allowed to upload and it works great, but if i go to the folder: c:\inetpub\wwwroot\imgupload\uploads
and try to view the image then im now allowed because i dont have any rights. Adding my user to file rights solves the problem but thats a bit silly aint it? im using php's move_uploaded_file()
any thoughts?
The webserver (IIS) and PHP run with different permissions as you yourself. It's the webserver that receives the file and writes it to disk. So it is entirely reasonable that someone else (i.e. you) does not have access to it.
The problem is that the 'user' creating the images isn't you, it is IIS. Consequently, you don't own the image, the server does.
You could try to do a chmod($file, 777);
after the file has been created to make it publicly accesible.
精彩评论