PHP File Uploading


I have a script which allows users to upload files through a web form to my server, however, I realised that all the files that are uploaded have a default permission attribute of "600". These files should actually be viewable by the user, which means it should be uploaded to a "644" permission.

Can someone advice me if this default permission attribute have to be made server side, or am I doing something wrong with my scripts?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

after uploading set the permission right with the PHP funtion CHMOD:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You could do a chmod on it just as php-webdesign has mentioned, but it would be better to set default permissions on the directory to which you're writing and for the user who is doing the writing.  Chmod is great but for security purposes, it would be better to config on the server instead of making PHP do the work.

If you are using a Linux web server you need to find out which user is writing the files (sometimes apache, sometimes nobody - depends on how the server has been config'd).  Then you can change the user's umask so that any files they write use the default permissions you've set.
i know... but the CHMOD way of PHP is good to work with if you haven't got full access to the server. but if you do have full access your way is bether :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.