Solved

how tp get just the extension of a file

Posted on 2006-07-21
1
176 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Unified and professional email signatures help maintain a consistent company brand image to the outside world. This article shows how to create an email signature in Exchange Server 2010 using a transport rule and how to overcome native limitations …
We asked our MSP customer base what their favorite tools were and how they help them serve clients. We focused our questions on favorite tools in the following categories: >PSA tools >RMM tools >Alert management tools >Communication tools and Mo…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

751 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