• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

File name input

Khayman

I'm sorry Hal...
Political User
#1
Ok, so I want to get the path to a file and send it to the server

I thought I could used the input type="file" thing because that automatically puts the little browse button on the page, which is neat.

BUT

That method sends the whole file to the server and I just want the path and filename.

So I want the browse button, which pops open a file selection window but not actual send the file

It seems simple to do, but I'm drawing a blank (except possibly with javascript), anyone?
 
#2
Just one question. What good would the filename and path be to the server? Or are you doing some kind of playlist generator or something similar?

I'm not sure if Javascript could do this at all, I don't think it has access to the file system.
 
#4
I've got an idea... Not sure if it'll work at all, but:

You use a regular file input in, say, form1. The the submit button doesn't submit, but rather starts a Javascript function which reads the file name from the file input (if this is possible, never tried), writes it into a hidden input in form2, and then submits form2. Sounds doable?
 

X-Istence

*
Political User
#6
Khayman said:
I've already tried that. I don't like it, isn't very cross browser friendly.

All browsers should be able to support it, other than the older ones, plus it is the only way one can do it. It is IMHO the best solution for now.
 

Khayman

I'm sorry Hal...
Political User
#7
Think i've got it sorted now. Originaly I was using a slight variation which was using a method which only works in IE, but is ok now
 

Members online

No members online now.

Latest posts

Latest profile posts

Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,961
Messages
673,239
Members
89,014
Latest member
sanoravies