Solved

File Upload : Default File Type when using BROWSE button

Posted on 2002-06-06
12
182 Views
Last Modified: 2010-03-31
I have seen a lot of applications on WEB which have a BROWSE button functionality allowing the user to search for a file on his computer and then upload it.

While searching for a file, this functionality uses standard Windows features to help the user to browse the file.

In our application we too are doing the same. But when we use this button, the DEFAULT FILE TYPE is always HTML files. We want to change this default to ALL FILES. Is it possible? If so, how?
0
Comment
Question by:iabmum
[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
  • 7
  • 4
12 Comments
 
LVL 9

Expert Comment

by:Ovi
ID: 7061147
What control are you using for browsing for the file ? For JFileChooser you can set the default filters (extensions) for files.
0
 

Author Comment

by:iabmum
ID: 7061181
We have just used the following HTML tag in our JSP.

<INPUT TYPE="file" NAME="FILE" SIZE="30" STYLE="WIDTH=300px;HEIGHT=22px">

0
 
LVL 9

Expert Comment

by:Ovi
ID: 7061323
I've test this and works fine. What browser are you using ?
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 

Author Comment

by:iabmum
ID: 7061384
I'm not saying that it doesn't work.

What I'm saying is that the DEFAULT file type is HTML. I want to change the default to ALL FILES.
0
 
LVL 9

Expert Comment

by:Ovi
ID: 7061521
When I say that is working it means that on my browser ask's for "All files" and not html.
0
 

Author Comment

by:iabmum
ID: 7061552
Well, in that case, would it mean that there are some settings required on your browser that could achieve this. For in our case, its not working.

BTW, we are testing on Netscape and not on IE. And Netscape is required, can't be wished off.

I haven't tested on IE yet.
0
 
LVL 9

Expert Comment

by:Ovi
ID: 7061620
Netscape 4&6; Mozilla, Konqueror : does not take into consideration the accept attribute.
However, netscape 6, mozilla, konquerror starts with the file filter *.*
Netscape4 starts with *.html but if you replace'it with *.* is ok.

Bellow is a cut&paste from a tutorial :

File selectors

File selectors are used to allow the user to select a file to send along with the form. They have a TYPE of file. The ACCEPT attribute can be set to limit the kind of files the user can send. You can set the VALUE attribute to be the default file name, however this is not a very good idea since guessing what a file will be called in the user's operating system is not easy. This technique is also unsupported by Navigator and Internet Explorer 4.0 and 5.0.
<FORM METHOD="POST" ACTION="/cgi-bin/html/formdump.cgi" ENCTYPE="multipart/form-data">
<H2>Graphics Contest</H2>
<P>Name: <INPUT TYPE="text" NAME="name" SIZE="30">
<P>Please submit your entry in PNG or GIF format:
<INPUT TYPE="file" NAME="entry" ACCEPT="image/png, image/gif">
<P><INPUT TYPE="submit">
</FORM>
0
 
LVL 9

Expert Comment

by:Ovi
ID: 7061623
0
 
LVL 9

Expert Comment

by:Ovi
ID: 7061737
Still there ?
0
 

Author Comment

by:iabmum
ID: 7062074
Ovi, I'll have to test it out to see if it works.
0
 
LVL 9

Accepted Solution

by:
Ovi earned 100 total points
ID: 7066207
That's the problem, the documentation sais that will work but in reallity it don't. I believe is browser dependent.
0
 
LVL 35

Expert Comment

by:girionis
ID: 8834168
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- points to Ovi

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0

Featured Post

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jboss wildfly 10.1 10 594
How to configure empty element in XML Document parser? 15 57
Eclipse with various Java releases 7 85
Coding for the first time 9 99
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

737 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