Having problem with getting the file name in Internet Explorer

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
royalcyberAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Mayank SConnect With a Mentor Associate Director - Product EngineeringCommented:
>> You may have to substring the full path to get the filename.

java.io.File.getName () will do that....
0
 
StillUnAwareCommented:
What is 'form_file_input'? How is that object created?
0
 
tbboyettCommented:
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
mukundha_expertCommented:
0
 
Mayank SAssociate Director - Product EngineeringCommented:
>> 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
 
royalcyberAuthor Commented:
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
 
Mayank SAssociate Director - Product EngineeringCommented:
>> 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
 
Mayank SAssociate Director - Product EngineeringCommented:
It could be more of a client-side problem at the browser too.
0
 
Mayank SAssociate Director - Product EngineeringCommented:
What was the problem? Why the B grade? You can ask for more clarification if you want.
0
All Courses

From novice to tech pro — start learning today.