Solved

Having problem with getting the file name in Internet Explorer

Posted on 2006-06-13
9
224 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
[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
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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 30

Expert Comment

by:Mayank S
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
 
LVL 30

Accepted Solution

by:
Mayank S 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:Mayank S
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:Mayank S
ID: 16917628
It could be more of a client-side problem at the browser too.
0
 
LVL 30

Expert Comment

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

Featured Post

Independent Software Vendors: 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
Way to decrease size of apk file 9 110
How  can  i  resolve  HTTP Status 404 -? 8 61
java imports not found 4 52
batch vs regular insert in spring DAO 2 25
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

730 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