• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 221
  • Last Modified:

Upload a file with filename already specified

How can I upload a file with the filename already specified?  I don't want to have to browse for anything.
Grant Fullen
Grant Fullen
2 Solutions
HTML won't let you do this.

but, I think you could use javascript to set the value after the page loads.

give the tag a unique id= to make the javascript easier

One solution would be to make a html page with a form
+ input button
+ JS, that would fill the input field

(without submit button)

I will try some script and get to you latter


As i found out:

It's a security issue. A file-type input can only be populated it's native control, or via keyboard input.

The value attribute (HTML) and the value property (JavaScript) don't work.

I found, that you could use value attribute in some browsers, that would have the default file.

But i didn't find any (try your browsers with this script):

<form enctype="multipart/form-data" action="upload.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" value="C:\Documents and Settings\blabla\Desktop\blabla.txt"/><br /-->
<input type="submit" value="Upload File" />

If you find a browser that fills in the file input you just need to write a script to submit your form (if that is what you need).

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.



The problem is that you cannot specify a default file path for more platforms - on linux there is no C:\ or a:\ thing.

The only browser that supports value attribute in file input is Opera. But it shows a security pop up with -> do you really want to... note.


MY IDEA: make a list of files (or one file) above the form and copy -> paste it to the form???
ok... just remembered something else...

What kind of file do you need to upload?

Where do you need to upload it to?

What is your platform?
most browser deny to set the value= for <input type="file" ...> for security reason, obviously ..
I found out you could make a JAVA applet...
Grant FullenAuthor Commented:
Great, a security flaw makes this ONE thing difficult for me lol.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now