on 06-09-2010 2:24 PM
Hi all,
I'm using the fileUpload UI element which is bound to IWDResource type.
When I run:
String fileExtension = resource.getResourceType().getFileExtension();
I get null for the fileExtension if the files types are "rar" or "msg" (for other filetypes there is no problem).
A simple workaround is to use:
if ((fileExtension == null) || (fileExtension.length() == 0)) {
String resourceName = resource.getResourceName();
fileExtension = resourceName.substring(resourceName.lastIndexOf(".")+1, resourceName.length());
}
Is this a known behaviour of the "getFileExtension" method?
J2EE/WD version is 7.00.20
Omri
Hi
Try this
public static String getExtension(File f) {
String ext = null;
String s = f.getName();
int i = s.lastIndexOf('.');
if (f.isDirectory())
ext = null;
else if (i > 0 && i < s.length() - 1) {
ext = s.substring(i+1).toLowerCase();
}
return ext;
}
BR
Satish Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.