[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Having problem with getting the file name in Internet Explorer

Posted on 2006-06-13
9
Medium Priority
?
232 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 1050 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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

656 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