[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

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
0
royalcyber
Asked:
royalcyber
1 Solution
 
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
 
mukundha_expertCommented:
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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
 
Mayank SAssociate Director - Product EngineeringCommented:
>> You may have to substring the full path to get the filename.

java.io.File.getName () will do that....
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now