Filter by file extension or type.

Filter by file extension or type.

  
HI, Can anyone one tell me how do I filter the Upload widget to allow only the image type files?
What should be the filter condition? HOw do I filter the file by its extension? Upload1.Type = ?
Hi,

in the upload widget's advanced properties add one named "accept" and then a value (eg."image/*")

Keep in mind this isn't supported in every browser, here's the link with the compatibility as well as the specification of the values you can enter.

Cheers,
António Chinita wrote:
Hi,

in the upload widget's advanced properties add one named "accept" and then a value (eg."image/*")

Keep in mind this isn't supported in every browser, here's the link with the compatibility as well as the specification of the values you can enter.

Cheers,
 I tried but it still accepts other type files. See the Image.
 
You must have done something wrong then.

 
António Chinita wrote:
You must have done something wrong then.

 
 
 No I did the same as you said. See the pic that I have attached now. Is there any filter condition i have to add? or Is there any other way to do so?
Works fine for me.

Do you mean that in the file finder you are still able to switch from "Image Files" to "All Files"?

If so, that is just default finder behavior, and you will have to validate file extensions when you submit your form, using the Upload1.Filename property.
António Chinita wrote:
Works fine for me.

Do you mean that in the file finder you are still able to switch from "Image Files" to "All Files"?

If so, that is just default finder behavior, and you will have to validate file extensions when you submit your form, using the Upload1.Filename property.
 Yeah thats what I'm asking bro. How should I validate? Upload1.Filename like ".jpg%"  ? or what?
 
There are a few ways to do this... You can use something like:
Substr(Upload1.Filename,
Index(Upload1.Filename,".",startIndex:,True,True)+1,
Length(Upload1.Filename)-Index(Var1,".",startIndex:,True,True)+1) = "jpg"
Cheers,
António Chinita wrote:
There are a few ways to do this... You can use something like:
Substr(Upload1.Filename,
Index(Upload1.Filename,".",startIndex:,True,True)+1,
Length(Upload1.Filename)-Index(Var1,".",startIndex:,True,True)+1) = "jpg"
Cheers,
 Oh thanks. But Whats the work of Var1 in the Index? Do I have to assign any value to the Var1?
 
Sathish D wrote:
António Chinita wrote:
There are a few ways to do this... You can use something like:
Substr(Upload1.Filename,
Index(Upload1.Filename,".",startIndex:,True,True)+1,
Length(Upload1.Filename)-Index(Var1,".",startIndex:,True,True)+1) = "jpg"
Cheers,
 Oh thanks. But Whats the work of Var1 in the Index? Do I have to assign any value to the Var1?
 
Sorry, replace that Var1 with Upload1.Filename
I forgot :)
 
António Chinita wrote:
Sathish D wrote:
António Chinita wrote:
There are a few ways to do this... You can use something like:
Substr(Upload1.Filename,
Index(Upload1.Filename,".",startIndex:,True,True)+1,
Length(Upload1.Filename)-Index(Var1,".",startIndex:,True,True)+1) = "jpg"
Cheers,
 Oh thanks. But Whats the work of Var1 in the Index? Do I have to assign any value to the Var1?
 
Sorry, replace that Var1 with Upload1.Filename
I forgot :)
 
 Thank you. Got it.
Just aquick question why do we need +1 at the Index? Usually Index will returns -1 if the search keyword is not found. but all the extensions are seperated by "." from the file name right? So the index search most probably doesn't return -1 right? I'd like to know for which case you have used +1.
Thanks.