Solved

how tp get just the extension of a file

Posted on 2006-07-21
1
177 Views
Last Modified: 2010-04-01
Hi I have this code

file_name = form_file_input.getName();
file_size = (int) form_file_input.getSize();
file_type = form_file_input.getContentType();

Now form_file_input.getContentType(); gets this value application/vnd.ms-excel for an excel file
but what I need is to get .xls so that I can add this .xls to the filename when I am saving the file.

Any help will be greatly appreciated



0
Comment
Question by:huzefaq
[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
1 Comment
 
LVL 12

Accepted Solution

by:
enachemc earned 500 total points
ID: 17154481
String fn = form_file_input.getFileName();
int posPoint = fn.lastIndexOf('.');
String ext = null;
if(posPoint > 0){
    ext = fn.substring(posPoint + 1);
}
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

Let's recap what we learned from yesterday's Skyport Systems webinar.
Choosing a core focus or particular set of features and options can be tough. To help out, we’re going to highlight a handful of things your business needs on one of your social media pages. In other words, if one of these is missing, you should imp…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

632 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