File upload problem

3 posts / 0 new
Last post
#1 Tue, 09/11/2007 - 23:43

File upload problem


One of our students just reported, that files uploaded using php get 600 permission. These files are not readable from a browser. How can I change that?

Tue, 09/25/2007 - 07:37

Hi Sebastian,

I had the very same problem here.

If you have access to the php source file (I mean, if its not encrypted)
look for the line where the php move the file from the temporary folder to the final target [ie: move_uploaded_file($tmp_name, $name);] and add this line:

chmod($name, 0644);

[of course you have to replace the variables in this example according to your souce]

It solves my problem, anyway I believe in some easier solution
[like set something in somewhere]


Tue, 09/25/2007 - 13:48 (Reply to #2)
Joe's picture

The simpler solution ought to be setting the default file mask. But I'm not sure if PHP is respecting the umask here. I'd love to hear from some PHP masters who can give us some guidance...I'm as confused by this behavior as you all are. ;-)


Check out the forum guidelines!

Topic locked