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.
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
Hi Stuart thank you for replying,
Regarding the configuration I have for JPGUpload here it is. Sorry for this unusual limitation it just so happened to be a requirement. The Regex I was talking about was the MustMatchFileNameRegex.
I tried using your suggested approach to try *.jpg, it just so happened as you predicted that the error message regarding the MIME TYPE appeared as "Expects .jpeg" file instead of "Expects .jpg" or something close.
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?
Hi Stuart,
What I was trying to say was the *.jpg worked it accepts upload of only file type jpg instead of jpeg. A big thank you for this.
It worked better than the MustMatchFileNameRegex. The problem was with the error message upload when JPG file was not the file type uploaded. The error says "Expects .jpeg" which will cause confusion on the user side.