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

Assigning default file when using the input type "file"

Hi I am using a file dialog to select an image and I want to set or assign in the text box the default filename what I wrote is:
<INPUT TYPE="FILE" NAME="fileImage" title="Browse Image" value="Default.gif">Image</INPUT>

but using the value="Default.gif" doesnt put the text default.gif in the text box of the component.
Can anyone tell me how I can place the default file name on the text box of the file component. You know when using the file component you have a text box and a browse button. I want to put the default filename in the text box.

Thanks in advance.
0
denz_1
Asked:
denz_1
1 Solution
 
FranzRinkleffCommented:
to begin with your input statement should look like this.  you forgot the accept attribute.

<input type="file" name="fileImage" title="Browse Image" accept="image.gif">
0
 
FranzRinkleffCommented:
i meant like this

<input type="file" name="fileImage" title="Browse Image" accept="image/gif">
0
 
denz_1Author Commented:
but I also want to accept jpeg, and still doesnt answer my question. how do I specify the default file.. such as default.gif or filename.gif
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
COBOLdinosaurCommented:
You cannot specify a value for this type of input.  It would be a huge
security hole.  the accept attribute being suggested by Franz is in the
HTML standard but is not supported by any browser because it would allow
a web site to steal files from a users computer.

If you want to limit the files to specific types, I can give you code
to do that kind of filtering, but you cannot force a value into this
type of input.

Cd&
0
 
FranzRinkleffCommented:
cobolDinosaur
I was not aware it was not supported by any browser.  I do something similiar with Cold Fusion and it prevents someone from uploading documents of the wrong type (at least that is what I think it is doing).

I am confused at how the browsers supporting this HTML standard would allow a web site to steal files from a users computer?  Please explain.  

Thanks, Franz
0
 
webwomanCommented:
Pretty obvious when you think about it...

If you can specify what file to upload, you can grab every setting on their computer, passwords files, etc. I could grab your mailbox file (there's only a few names/places for them), which would conceivably have all your addresses, e-mail accounts, and any usernames/passwords for sites you've signed up for -- and that's just for starters.

You'd never know. YOU wouldn't pick the file, you probably wouldn't even see the upload happen.

That's why it's a HUGE security hole and why no browser supports it.
 
0
 
FranzRinkleffCommented:
the accept attribute specifies the TYPE of file to upload NOT the file to upload.  How would this present a security hole?  

I understand why having a default file name to upload would be a problem.
0
 
COBOLdinosaurCommented:
Franz,

Sorry, I was trying to combine too many thoughts in one
sentence.  The accept attribute is not supported was thought 1.
The accept attribute still would not do what they want which is
set a default, was thought 2.  Being able to set a default would
allow the theft of files was thought 3.

All of which got scrambled together, and ended up somewhat
incoherent dinosaur babble.  

Cd&
0

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