Laravel上传文件,权限较低

Good day everyone.

I am building a Laravel 4 application and I have some file permissions issues.

Once the file has been uploaded by the client, it's moved in a folder. However, the file gets very little permissions, is assigned the user www-data and can't be touched / moved by anything else.

I need to know how to dynamically permit laravel to have permissions on those files because I'm using CloudConvert to convert this file.

I'm on Ubuntu 14.04 also and my prod is on debian. I already tried to chmod -R the folder, which works for files already saved, but when new ones are created, it doesn't work anymore and stays in www-data ready-only low permissions.

Thank you for your answers.

EDIT : I might have found something : chmod g+s with given permissions. I read it gave recursive permissions to created files. I'll try once I'm home.

It was a stupid mistake on my side, I'm afraid.

I was renaming the file before curl could pass on it, making it unable to know what was the original file name (getClientOriginalName()).

That account "www-data" is the default account for the web server. That is why it becomes the owner of the files and has full access to them, from a web angle. If what is happening is that you are trying to then convert the files outside the web context (like a cron job or something) then you need to make sure the same user (or maybe a group) owns the files. Have not tried CloudConvert (looks cool, will check it out) but maybe you can leverage Laravel's queues and that way execute your conversion with the web server's "www-data" account?