CodeIgniter Forums
How to change permissions of uploaded file? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to change permissions of uploaded file? (/showthread.php?tid=25762)



How to change permissions of uploaded file? - El Forum - 12-23-2009

[eluser]admiral[/eluser]
Hello,

after moving my project to a new server I've got a problem with permissions of uploaded files (using File Uploading Class). How can I define file permissions before uploading or change it after uploading (php function chmod or something)?


How to change permissions of uploaded file? - El Forum - 12-23-2009

[eluser]codebreaker21[/eluser]
There is a php function for this : chmod
http://php.net/manual/en/function.chmod.php
If you get an error while using it you can try this :
http://www.php.net/manual/en/function.chmod.php#68384
Codebreaker21.


How to change permissions of uploaded file? - El Forum - 12-23-2009

[eluser]admiral[/eluser]
Yes, I know this function. But I have no idea how to use it in conjunction with CI's do_upload(). I mean, I don't know how to determine the name of saved file which doesn't have to be the same as the name of local file.


How to change permissions of uploaded file? - El Forum - 12-23-2009

[eluser]codebreaker21[/eluser]
http://ellislab.com/codeigniter/user-guide/libraries/file_uploading.html
Take a look at $this->upload->data() .This should be exactly what you need.


How to change permissions of uploaded file? - El Forum - 12-23-2009

[eluser]admiral[/eluser]
Thank you very much Smile I haven't noticed that.