cancel
Showing results for 
Search instead for 
Did you mean: 

Upload file type restrictions in Smartedit

michielc
Explorer
2,121

Hi,

We have some objects with Media attributes, which should be able to contain both videos (.mp4/.webm) and images (.png/.jpeg/.jpg/.webp). When importing media using impex, we can import al of these file extensions and all of these files are correctly displayed.

Another requirement is that these attributes should be modifiable via Smartedit (e.g. a video should be replaceable with another video or an image). Now, uploading .jpg and .png works, but when we try to upload .mp4 (or .webm or ...) in Smartedit, we get the error that the 'Selected file type is invalid'.

I've tried modifying the seFileValidationService.js file of the cmssmartedit extension by adding the required extensions to the ACCEPTED_FILE_TYPES-line (line 31), but this doesn't seem to work, even after an ant clean all + server restart.

Does anyone know how we should modify these file type restrictions?

Thanks in advance!

sandhyam
Explorer
0 Kudos

Hi,

We are using OOTB smartedit.
Is it possible to upload zip directly in media section in smartedit? If so, how can it be done?

Thanks

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member645853
Participant
0 Kudos

Have you found solution ?

former_member645853
Participant
0 Kudos
It helped me to add ability to upload GIF files in smartedit:
public VALID_IMAGE_MIME_TYPE_CODES: string[] = [
'FFD8FFDB',
'FFD8FFE0',
'FFD8FFE1',
'474946383761',
'474946383961', // gif magic number
'49492A00',
'4D4D002A',
'89504E470D0A1A0A',
'3C3F786D6C207665', // svg magic number'3C73766720786D6C' // svg magic number];
0 Kudos

Hi everyone, i am facing issue(selected file type is invalid) while uploading .svg image from (UPLOAD IMAGE TO LIBRARY) but i am able to add png,jpg images.

Does anyone know how we should modify to achieve the above...

Former Member
0 Kudos

Hi Michiel,

Besides modifying "seFileValidationService.js" you should also modify "seFileMimeTypeService.js" and add the magic number for the file type you would like to accept.

Both these .js files are processed and concatenated into "cmssmarteditContainer.js" which resides in the webroot. So after modifying the "seFileValidationService.js" and "seFileMimeTypeService.js" you will need to have the hybris platform also run the 'grunt build tasks'. To do so you would need to run 'ant npminstall' and after 'ant clean build' that will result in an updated "cmssmarteditContainer.js" file.

It is a kind of dirty trick to achieve this, but it will work. The best approach will be building a customized smartedit editor.

Regards, Emil

nicolabeghin-2
Employee
Employee
0 Kudos

thanks Emil! really appreciated

0 Kudos

Hi Emil, I am getting same error "Selected file type is invalid".After changed both file "seFileValidationService.js" and "seFileMimeTypeService.js" .I am uploading also mp4 file type. Is there something need to change somewhere. Please suggest to me. It would be much appreciate .

BR, Omkar

0 Kudos

Hi Michiel, I am getting same error "Selected file type is invalid".After changed both file "seFileValidationService.js" and "seFileMimeTypeService.js" .I am uploading also mp4 file type. Is there something need to change somewhere. Please suggest to me. It would be much appreciate .

BR, Omkar

Former Member
0 Kudos

Hi Michiel,

I am having same issue with uploading files in smartedit, Did you find any solution for that if yes please share.

Thanks

0 Kudos

Hi Zafir, It is better to created your own custom isolated scope directory directory which is bind model for file upload depend on on your file upload type as well as use exist rest call media api