File Upload Issue
Created 2 years ago by andrea

Hello there, I'm quite new to Laravel (therefore PyroCMS) and I'm experiencing an issue with file upload in admin panel. I have followed every step for a PyroCMS fresh install:

composer create-project pyrocms/pyrocms dns setted to have /public/ as root folder permissions setted to 775 (at first) and 777 (at last) for almost all folders (public, storage, resources, bootstrap and so on)

When I try to upload a file using admin panel "admin/files/upload/images" a popup shouting "Page Not Found (404)" shows up.

I'm using a virtual host with Nginx

ryanthompson  —  2 years ago Best Answer

This happens when you have NGINX skip the controller before checking for files in the CMS. Try modifying your location bracket for files like this:

location ~* \.(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm)$ {
    try_files $uri $uri/ /index.php?$query_string; # hit the CMS first to see if it can handle it
    access_log off;
    log_not_found off;
}
andrea  —  2 years ago

Thank you very much

ryanthompson  —  2 years ago

Sure thing! Be sure to mark the answer so others can identify it quickly as well 😊

pooria  —  5 months ago

@ryanthompson I have the same problem. But the problem exists only if I try to upload from the WYSIWYG editor. It's OK through the Files Module.

What is the problem?