6
Views
4
Comments
[FilePondUpload] [FilePondUpload] Differentiating JPEG and JPG
Forge component by Stuart Harris
6
Published on 19 Mar 2020

Good Day Community. 


Currently I have two types of upload on a reactive platform. One requires JPEG and the other requires JPG file. In order to do this I used the regex function available on the FilePondUpload component.

Problem I have is on uploading JPG file only. I have to set the file extension to image/* to allow the uploading of images. The problem is, if it is available to change the error message on the bottom left. Or is there an available file extension for jpg?

On JPEG file uploading only I have no issues.


JPG ONLY

JPEG ONLY

Thanks in advance to anyone who have ideas.

Champion
Rank: #154

Hi Leonard,

Thanks for your question.

It is not possible with the component to adjust the "Expects.." error message.

However, there may be another way to use the configuration to get what you are after.  To limit upload to specific file types you can set Config.AcceptedFileTypes to a list of file types such as '*.jpg', '*.jpeg'.

It is a little unusual to limit to jpg but not jpeg, as there is no different between the actual file type for those extensions.  This may cause some issues when the browser informs the upload component of the file's MIME type. However, if that is your requirement, fair enough.

If this does not help, maybe post the details of your configuration.  I am a little unclear what you meant by the 'regex function'.  Posting the config will help clarify that.

I hope this helps!

Kind regards,

Stuart

Champion
Rank: #154

Thanks Leonard.  Ah that makes it clear now.

Yes, the MustMatchFilenameRegex is only for specific scenarios where you want to validate the filename.  It was added as a request for that specific functionality, even though it had to be somewhat hacked into the integration with the FilePond library.

Do you mean that you tried using AcceptedFileTypes with just *.jpg but that it does not allow you up upload a file ending in .jpg?