How Can We Help?
Adding File Type ExtensionsAdding File Type Extensions
What
It is possible to add files to different kind of content, depending on your setup it can be done manually or through synchronisation.
When working with content with files you can come across different error scenarios. Most often this is because of a check on the file extension.
The common scenarios is:
- In the editor window you are getting the error "You can't upload files of this type" when trying to attached a file:
- In the editor window you are getting the error "Invalid file extension" when trying to save an existing record:
- In the synchronisation job log you are getting the error "The document x does not have a valid extension":
How
- We introduced checks for image uploads in 5.17.0. Now you as an administrator can control what file type extensions are allowed.
- If you want to include more extensions, you can configure this in Administrator > System settings > Image Extensions
- If you want to include more extensions, you can configure this in Administrator > System settings > Image Extensions
- For the synchronisations you need to ensure that the MimeType is in the XML. Here's an example on a jpeg file and how the MimeType is structured in the XML:
<v1:data> <v1:http> <v1:url>https://ThePictureURL</v1:url> <v1:mimeType>image*/jpeg*</v1:mimeType> <v1:fileName>ThePicture.jpeg</v1:fileName> </v1:http> </v1:data>
From 5.17.3
- Files deemed with a non-valid file extension will now be ignored (and warning shown) instead of the content throwing a validation error.
- Files with no extension (eg. "/some/path/to/image") will now try to figure out file extension based on the optional file name and mime type.
- This is some XML examples and the result:
<photos> <personPhoto id="personPhotoAssoc1"> <classification>portrait</classification> <data> <file> <path>/Users/johndoe/Desktop/photo</path> <fileName>photo.jpg</fileName> <!-- This will work --> <!-- Pure will use file name to figure out that its a .jpg --> </file> </data> </personPhoto> <personPhoto id="personPhotoAssoc2"> <classification>some_random_photo</classification> <data> <file> <path>/Users/johndoe/Desktop/photo</path> <mimeType>image/jpeg</mimeType> <!-- This will work --> <!-- Pure will use mime type to figure out that its a .jpg --> </file> </data> </personPhoto> <personPhoto id="personPhotoAssoc3"> <classification>some_random_photo2</classification> <data> <file> <path>/Users/johndoe/Desktop/photo</path> <!-- This will NOT work --> <!-- Pure cannot figure out what this file is --> </file> </data> </personPhoto> <personPhoto id="personPhotoAssoc3"> <classification>some_random_photo3</classification> <data> <file> <path>/Users/johndoe/Desktop/photo2.png</path> <!-- This will work --> <!-- Pure will figure out that is a .png and has mime type image/png based on path --> </file> </data> </personPhoto> </photos>
Note: In cases where the source cannot be updated to give a normal file name (e.g. web-services with parameters) it is possible to disable the check by clearing the field of all types. Be careful about doing this, because you could end up with non-valid file e.g. images on the portal (like people uploading pdfs or zip files etc).
More information
Note: Some of this information is for internal use only and might not be accessible.
Updated at July 27, 2024