Can I use clientvalidation to validate file type when I want to upload file?. I’ve declared the enableClientValidation=>true, but it refreshed the page(the error message appeared). I expect validation based on client side. What am I supposed to do?
FYI in related model I’ve declared the file type already.
I think that for file uploads you cannot validate on client side only… as the server needs to upload the file… so that it can check/validate it…
regarding this subject, do you guys have any idea on how to get the mimetype description when you have only the extension text?..i’ll try to explain it better:
i want users to upload only those files that matches filetypes in a parameter field like
|__fileTypes = ‘jpg, png, svg, gif’
this is easy when you deal with client side, i just add the filetypes to validation rules of some plugin like jumploader or even fancyupload
the problem is that in the server side i want to check if the file mimetype is valid accordling to the params…i thought about getting the mimetype description for valid filetypes by using getMimeTypeByExtension and then using getMimeType for getting the file’s real mimetype, so i could validate it…
do you guys have a better approach for this? is there any existing function that translates extensions into mime descriptions?
thanks in advance