This has not been a problem in the past, it only started happening recently. I updated from version 3.5 to 3.7.5 to see if that would help but it’s still throwing the same error.
Have you changed the version of php being used on your remote server? It might be that the PHP ini has changed and the max file size of uploads is smaller than it used to be. The default i believe is 2 megabytes.
You can usually check / set these values through your hosting control panel rather than having to so it manually.
Update: Turns out it’s something to do with the PDF / one of the fonts.
When I outline the text in InDesign or Illustrator, the PDF uploads fine. However, when the PDF is exported with text that is not outlined, it throws the error “The file could not be uploaded”.
There are only two fonts used in the PDF so I tested them individually. Strangely, the error only happens with ABC Whyte Medium.
Unsure if this is an issue with the font file or a Kirby bug? Unsure if I need to contact ABC Dinamo or whether this concerns other similar fonts…
This isn’t ideal because the client will need to update the PDF themselves so getting them to outline the text everytime is an extra step that could cause issues in the future.
This sounds strange to me. A PDF file is nothing special regarding the fonts. Maybe some heuristic of some IT security solution (anti virus, firewall, web application firewall, …) is triggered due to the specific font like a false positive?
Another idea, maybe the font adds massively to the file size thus breaking some limits?
This does’t make sense, because $page->files()->first() would already return a file object (or null if there are no files), so you cannot convert that to a file object again with toFile(). toFile() is a field method you would call on a files field.
Regarding the PDFs: So a standard PDF upload works and you only have this issue with particular PDFs?