New: Learn Statamic on Laracasts!

We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Inconsistent file upload behavior

Jamie Wagner September 18, 2014 by Jamie Wagner

I'm having an issue when I upload a file and save. The file is uploaded and the filepath is correct in the content file. When I go to edit the entry in the admin, the file shows up in the file field, but when I save is removed. The actual file is still there, but the field info on the content file is removed.

I've tracked it down to being case sensitivity of the file extension. So my file name is image.JPG and in my allowed types for that field, it's listed as 'jpg'.

So when the file select is being built, it doesn't pull in the .JPG file, isn't marked as selected, and is lost on form submission.

In _app/core/bundles/file/ft.file.php, line 63:

If you update the name method param from:


to a case-insensitive regex:


Everything works as expected.

I think it makes sense that if I allow 'jpg' as a filetype that it would include all case'd types (JPG, jPg, Jpg, etc...) without having to explicitly list each one in the allowed types.

Answered by Jamie Wagner!
>>>>>>> Answered <<<<<<<
5 Replies