We are just setting up a new OJS 3 site and would like to start with SVG graphics in the header right away. To do this cleanly, I have tried to implement the changes from the relevant commits mentioned in issue 2513.
After that, select the SVG file from the “Select File…” window or by drag/drop works fine (this had previously lead to the error message “File extension error”).
But on clicking “OK” in the upload box, I’m getting the error message “No file uploaded or invalid file type!”. Uploading a PNG file works fine on the same install.
unfortunately not. It is still possible to upload the file (at least the upload animation shows), but when clicking “OK” in the upload box, I’m getting the error message “No file uploaded or invalid file type!”.
I’m on OJS 3.0.2 with this problem, could there be other commits/issues that are required?
OJS identifies MIME types using a variety of tools, depending on which is supported on your server platform. See the PKPString::mime_content_type function for the implementation of this. It might be useful to check that code against your server config to find out which is being used, then identify how that method is looking at SVG files to determine whether a rule tweak or something will resolve the issue.
There’s also a few helpful exceptions listed in that function. It might be worth adding another for SVG if you think this is a common misdetection.
Public Knowledge Project Team
yes, I have temporarily entered some PHP logging commands into that function to see which of the three cases of if (function_exists(' is used on our server, but it seems the problem is related to the software producing the SVG.
We have found reports like this one saying that Illustrator behaves strangely when exporting to SVG. Our files have been created using the same software, so probably that is the cause and the place to solve it for us.
In general, the mime type "text/html"which is the mime type produced in some cases, could well contain undesired elements for a page header (which is where we are trying to upload the file). So I’m not sure about adding that as an exception, unless the problem becomes more common.