Web File Validation

  • Thread starter Chase Preuninger
  • Start date
C

Chase Preuninger

I want users to give me the url to a file on he web other than html,
htm, jsp, asp, etc. Then I need to validate that it exists, and then I
need to make sure that it is <i>someName<b>.</b>someType</i>. any
Ideas???
 
J

Jeff Higgins

Chase said:
I want users to give me the url to a file on he web other than html,
htm, jsp, asp, etc. Then I need to validate that it exists, and then I
need to make sure that it is <i>someName<b>.</b>someType</i>. any
Ideas???

Politely ask within your group of users for a URL to a file
(other than html, htm, jsp, asp, etc.) on 'he web'.

<http://java.sun.com/docs/books/tutorialNB/download/tutorial.zip>

If you mean to say the Internet rather than 'he web' then see:

The Java Tutorial - Custom Networking Trail
<http://java.sun.com/docs/books/tutorial/networking/TOC.html>
in particular the Working with URLs section,
<http://java.sun.com/docs/books/tutorial/networking/urls/index.html>
and its' subsection Parsing a URL.
http://java.sun.com/docs/books/tutorial/networking/urls/urlInfo.html
 
R

Roedy Green

I want users to give me the url to a file on he web other than html,
htm, jsp, asp, etc. Then I need to validate that it exists, and then I
need to make sure that it is <i>someName<b>.</b>someType</i>. any
Ideas???

try downloading the file with a GET and aborting. You can also try a
HTTP HEAD, though I suspect some websites will not let you do that.
 
C

Chase Preuninger

I have been designing a web site where the users basically enter a
file and I will index it in my database. I need to make sure the file
exists, and that the file has a valid extension, and that it is a
valid type. The reason I need to validate it is because it do not
actually upload the file; I just create a link to it on my site.

IE. www.google.com is invalid.
www.google.com/file.exe is valid.
 

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

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,141
Latest member
BlissKeto
Top