Knowledgebase
Change file permissions upon file upload - PHP
Posted by Tushar D on 07 November 2014 01:53 PM

Just use chmod() after your upload functions..

<?php

/* 
 * All your upload code here; then pass the filename
 * to the chmod below
 */

chmod($uploadedFile, 0644);

?>

Official documentation:

http://php.net/manual/en/function.umask.php

states:

"It is better to change the file permissions with chmod() after creating the file."

The documentation refers to the umask php function, however, the same principle applies in general.

(2 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below. This is required to prevent automated registrations and form submissions.

Copyright - SKY DEVELOPMENT, All rights reserved.