Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Assigning default file when using the input type "file"

Posted on 2001-09-17
8
Medium Priority
?
174 Views
Last Modified: 2011-09-20
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
Comment
Question by:denz_1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 1

Expert Comment

by:FranzRinkleff
ID: 6487923
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
 
LVL 1

Accepted Solution

by:
FranzRinkleff earned 150 total points
ID: 6487925
i meant like this

<input type="file" name="fileImage" title="Browse Image" accept="image/gif">
0
 

Author Comment

by:denz_1
ID: 6488150
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6488244
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
 
LVL 1

Expert Comment

by:FranzRinkleff
ID: 6488396
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
 
LVL 19

Expert Comment

by:webwoman
ID: 6488458
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
 
LVL 1

Expert Comment

by:FranzRinkleff
ID: 6488470
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
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6488596
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question