NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Poul on September 02, 2015, 12:20:47 PM

Title: Validating a filename for Uploading
Post by: Poul on September 02, 2015, 12:20:47 PM
I would like to validate the File name being uploaded
which appears to be something i can only do after the File is actually transferred.

Currently I can reject the file, but was looking for a simple way to convey this to the User
I currently have an Alert but after clicking ok the
Upload button text says "Uploaded" and i would like to conditionally indicate its invalid - - "Wrong File name"
and re-arm things so the user can try again.

In an ideal world i would like to pass the file name (or Mask like *.PDF) to the jquery bit, so it can validate
or abort the Update if its not a Specific value (before it finishes the upload) and update the user appropriately.
Title: Re: Validating a filename for Uploading
Post by: Bruce on September 03, 2015, 12:18:21 AM
Hi Poul,

you can set the "file selector" in the browser to be like "*.pdf" as the initial list of files, but of course nothing stops a user adding some other file if they want to .

At the moment I don't have any JavaScript in that enforces the file extension before upload.

cheers
Bruce
Title: Re: Validating a filename for Uploading
Post by: Poul on September 03, 2015, 07:16:22 AM
Quote
you can set the "file selector" in the browser to be like "*.pdf" as the initial list of files,
any tips on how to do that?  Chrome and FF seem to be *.* only?

i was poking around at http://blueimp.github.io/jQuery-File-Upload/jquery-ui.html
and the demo does limit the  filetypes - though its not clear if thats additional server code or not.

the documentation on acceptFileTypes seems to be what i want.


drat, i just realized my NT is bit older and you added acceptFileTypes  support a few months back
i need to regroup!

thanks  poul
Title: Re: Validating a filename for Uploading
Post by: Bruce on September 03, 2015, 09:19:30 PM
ha ha - well you gotta keep up mate <g>

cheers
Bruce