Uploading files with the the file manager : error mesage (permissions)

Permalink 1 user found helpful
Hello,

Before I begin, I'd like to say that I am now bald, I haven't had any sleep in the last 4 days and I did search this forum for solutions before I posted... Many info on this subject but nothing would work on my site...

I "sometimes" get this error message when trying to upload files via the file manager :

"Unable to copy file to storage directory. Please check permissions on your upload directory and ensure they can be written to by your web server."

Sometimes, the file will upload, sometimes it won't... Sometimes it will after 3 times I try... When doing a multiple upload, some files will upload, others won't...

I recently did many thing to my site :
1- I migrated to a new server.
2- The migrations instructions were not to clear on certain aspect so I had to do as best as I could, with my limited knowledge...
3- I tried to repair permissions of many files and folders
4- I made sure with my server admin that the PHP safe mode was off. It is...
5-I uploaded to the latest version of concrete5.

I now I'm not giving much to work with... But this is all I've got... I'm a total newb, eager to learn though...

Thanks for your help

P.

infinityunit
View Replies:
JohntheFish replied on at Permalink Reply
JohntheFish
I can't give you a solution. But Here is an angle to investigate.

Files are uploaded across a fairly random set of folders & subfolders.

- Keep notes of which folders the uploads were refused for and which they were accepted for.

- Does that correlate with any differences in the permissions of the folders (755, 777 etc...)?
infinityunit replied on at Permalink Reply
infinityunit
«Keep notes of which folders the uploads were refused for and which they were accepted for.»

hum, and how can I do that?

Thanks
JohntheFish replied on at Permalink Reply
JohntheFish
For successful files, you could use the file manager to get the actual file path, or the list files from set addon to list a set with their actual paths.

For failed files, if you don't get the file path from the error message you could temporarily hack the uploader where the error is generated to append the path to the message or output it to the log (depends how happy you are hacking php). In fact, if you were hacking the php to add diagnostics, you could report what permissions were found as well.
infinityunit replied on at Permalink Reply
infinityunit
OH that is way over my league!!!

I cannot possibly do that... In fact I'm thinking about deleting everything and starting from scratch...

It seems to me the best solution to ensure everything is OK again...

A lot of work, but work I know how to do :)

Thanks anyway

p.
JohntheFish replied on at Permalink Reply
JohntheFish
If you are about to delete and start again, you have nothing to loose by playing a bit and seeing if it is recoverable.

Browse the permissions of the /files folder and any subfolders and look for anomalies in the permissions, or try just setting /files and all subfolders recursively to 755 (safest) or 777 (lax and not as secure).
pmarques replied on at Permalink Reply
pmarques
I have been fighting this issue teh whole day and now I finally figured it out, and thought I would share the solution.

If your problem is the same as mine was, what happens is that the new folders with random names that C5 creates are created with the wrong permissions. No matter how many times you set permissions in /files, new folders won't get those permissions.

In my case, adding this line to config/site.php fixed it:

define('FILE_PERMISSIONS_MODE',775);
infinityunit replied on at Permalink Reply
infinityunit
That, I tried... didn't work...