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?
The MIME type is not being correctly detected for the SVG files (it should be image/svg+xml). This is detected in the PKPString::mime_content_type function.
The area you’re uploading the image to still doesn’t permit SVG images. Where specifically are you uploading the file?
Regards,
Alec Smecher
Public Knowledge Project Team
it seems like there is a problem with the mime type. As mime type, text/html is detected. Some web search results suggest that this is due to the Adobe software being used:
We will work on this further, as enabling upload for text/html is not an option for header graphics.
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.
Regards,
Alec Smecher
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.