By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,466 Members | 1,202 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,466 IT Pros & Developers. It's quick & easy.

Check if File Path Exists in Browse Text Box

P: n/a
The user can select a file in the file open dialog using <input type="FILE">,
but the user can also enter the full file path in the browse text box manually.
My question is if there are JavaScript to check if the file path exists?

please advise. thanks!!
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Matt wrote:
The user can select a file in the file open dialog using <input type="FILE">,
but the user can also enter the full file path in the browse text box manually.
My question is if there are JavaScript to check if the file path exists?


There is no way to test what you want to test when the browser is running the
default security environment.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #2

P: n/a
Grant Wagner <gw*****@agricoreunited.com> wrote in message news:<41***************@agricoreunited.com>...
Matt wrote:
The user can select a file in the file open dialog using <input type="FILE">,
but the user can also enter the full file path in the browse text box manually.
My question is if there are JavaScript to check if the file path exists?


There is no way to test what you want to test when the browser is running the
default security environment.

so you meant client-side validation cannot check in this case? so what
can I do about that? I need to do in server-side validation??

please advise. thanks!!
Jul 23 '05 #3

P: n/a
Matt wrote:
Grant Wagner <gw*****@agricoreunited.com> wrote in message news:<41***************@agricoreunited.com>...
Matt wrote:
The user can select a file in the file open dialog using <input type="FILE">,
but the user can also enter the full file path in the browse text box manually.
My question is if there are JavaScript to check if the file path exists?


There is no way to test what you want to test when the browser is running the
default security environment.


so you meant client-side validation cannot check in this case? so what
can I do about that? I need to do in server-side validation??


Your server needs to be capable of accepting a <form ... enctype="multipart/form-data"> of arbitrary size.
The code on the server which receives and saves the file can verify it's size and ensure it's name conforms
to the requirements of the file system it is being saved to (by removing or replacing unacceptable
characters).

Typically the server will have some limit on the amount of data it can accept via POST. The server itself
will typically deal with requests to POST data than is allowed with an error of it's own. For example, in
apache I think it's the LimitRequestBody directive <url:
http://httpd.apache.org/docs/mod/cor...mitrequestbody /> that controls the maximum size of a
GET/POST/PUT.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.