FORUM PLAN UPDATE
Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.



Apr 17, 2013, 9:32 PM
90 Posts

Validate in file upload control that a PDF has been uploaded

  • Category: Other
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags: File upload control validation
  • Replies: 4
 Is there a way to validate, in a file upload control, that a PDF has been uploaded and no other file format?
 
Many thanks, Randal.
Apr 18, 2013, 2:21 AM
54 Posts
Re: Validate in file upload control that a PDF has been uploaded
In the file Upload control - All Properties - basics - accept
Apr 18, 2013, 3:49 AM
17 Posts
Re: Validate in file upload control that a PDF has been uploaded
 
in the property accept  specify the type of the desired file as "application/pdf"
 
I allow images, pdf and msword files in my upload as in (suppose could be a static value as well)

<xp:this.accept><![CDATA[${javascript:"image/gif,image/jpeg,image/pjpeg,image/png,image/bmp,image/tiff,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"}]]></xp:this.accept>   
Apr 18, 2013, 10:43 AM
90 Posts
Re: Validate in file upload control that a PDF has been uploaded
Amazing, thank you both, it works.

 
I see that it just blanks out the upload field, with no word of explanation; I wonder if there's a way to communicate with the user why their upload got blanked out. 
Apr 18, 2013, 11:32 AM
54 Posts
Re: Validate in file upload control that a PDF has been uploaded
One way is to use an error control for the fileUpload control.

FORUM PLAN UPDATE
Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.