close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

limiting file upload to only pdf's

Thread began 8/10/2017 5:27 am by Jamie | Last modified 8/18/2017 10:49 am by Ray Borduin | 1126 views | 6 replies |

Jamie

limiting file upload to only pdf's

Hey Ray

On the attached page, am trying to limit the field SampleMenu to fail if anything other than a pdf file is uploaded.

I cant seem to get that to work and not sure if my regex expression is correct within the server validations:

$WAFV_Errors .= WAValidateRX($row_WADApage_contents['SampleMenu'] . "","^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.pdf|.PDF)$",false,11);



Thanks

Jamie

Sign in to reply to this post

Ray BorduinWebAssist

You are validating a row from a recordset in this code. You should be validating the name of the file uploaded. You should be able to get the file name or even the file extension from the bindings panel and use that to do your validation.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

cheers Ray

Have done that (see attached) but its still allowing anything to be uploaded even though I specified .pdf in the server validation

Sign in to reply to this post

Ray BorduinWebAssist

It won't be able to stop the upload, it would just stop the update or insert after the upload. You would have to use client validation to stop the upload in the first place.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

would I do that with a WA extension or do I need to find some js to achieve this?

Sign in to reply to this post

Ray BorduinWebAssist

Actually I misspoke. It will automatically upload, but it shouldn't transfer the file to the destination directory. It would remain in the tmp directory and be removed later. Is the file being uploaded to the destination directory? It looks like it would work to me.

Actually I think I see it. The value you should be using should be from the FORM bindings, not the UploadFileField bindings. That wouldn't be available until after the webassist upload code runs.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

many thanks

took a few attempts as I started off binding against the form SampleMenu Extension and then tried Simple File Name - neither worked

Then I tried SampleMenu only and it works a treat

Jamie

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...