Check if File Path Exists in Browse Text Box

M

Matt

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!!
 
G

Grant Wagner

Matt said:
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.
 
M

Matt

Grant Wagner said:
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!!
 
G

Grant Wagner

Matt said:
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/core.html#limitrequestbody /> that controls the maximum size of a
GET/POST/PUT.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top