Solved

Having problem with getting the file name in Internet Explorer

Posted on 2006-06-13
9
220 Views
Last Modified: 2010-03-31
I have a form where user can upload differnt documents. On the backend I save these documents based on a ID and filename. I get the file by using the following line
file_name = form_file_input.getName();

Now it works perfectly fine with firefox :) but not in IE:(

In firefox the document "Hello" is saved as 1020202Hello.doc
While in ID it is saved as 1020202C://documents and settings ... Hello.doc

Anypne know how can I get only the file name which would work in both the browsers

Thanks
0
Comment
Question by:royalcyber
9 Comments
 
LVL 14

Expert Comment

by:StillUnAware
ID: 16898668
What is 'form_file_input'? How is that object created?
0
 
LVL 5

Expert Comment

by:tbboyett
ID: 16898955
Are you using java for this?

You may have to substring the full path to get the filename.
Example:
lets say we have
C://documents and settings/somefolder/subfolder/Hello.doc

you would just look for the last / and get the index of that / and grab everything after it
0
 
LVL 10

Expert Comment

by:mukundha_expert
ID: 16899394
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 16900688
>> it works perfectly fine with firefox :)

Because its a good browser.

>> but not in IE:(

Because its.... ;-)

>> file_name = form_file_input.getName();

Is form_file_input a java.io.File object?
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 30

Accepted Solution

by:
mayankeagle earned 350 total points
ID: 16900693
>> You may have to substring the full path to get the filename.

java.io.File.getName () will do that....
0
 

Author Comment

by:royalcyber
ID: 16915690
I get the form_file_input like the

FileItem form_file_input = UploadUtil.getFileInput("ATTACHMENT", input_fields.iterator());

and I get the name like this

image_name = form_file_input.getName();

it gives me just the name when I run the application on Firefox but if I run the application on IE it gives me the full address of the file with the name


Thanks
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 16917627
>> FileItem

That's the Apache utility? Well, looks like you'll have to ask in their forums as to why it behaves wierdly on different platforms.
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 16917628
It could be more of a client-side problem at the browser too.
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 16978143
What was the problem? Why the B grade? You can ask for more clarification if you want.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
topping3 challenge 14 52
java  and programming certification ? 4 65
Free Alternative to JIRA 4 58
Java Timer (static) 9 18
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now