cancel
Showing results for 
Search instead for 
Did you mean: 

File name filter for FileUpload UI Element

Former Member
0 Kudos

Hi,

I was trying to use the FileUpload UI element in WebDynpro Java. In that when i click on "Browse" button, I want only *.xlsx files to be shown instead of all files.

I have created a view with the FileUpload ui element and bound it with a resource context attribute which is of type com.sap.ide.webdynpro.uielementdefinitions.Resource

How can i set a filter on the FileUpload ui element so that it should show only a specific type of files in the selected folder.

Any help regarding this would be highly appreciated.

Thanks and Regards,

Santosh Giri

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank you very much for all the support.

Former Member
0 Kudos

Hi,

There is one method for get the resource extension. you can use that to filter that.

IWDResource resource = null // Assign the right resource here.;

if(resource.getResourceType().getFileExtension().equalsIgnoreCase("pdf")){

//do success things

}else{

// Prompt for Right type of file

}

Regards

Jeetendra.

Former Member
0 Kudos

Hi,

Thank you for the reply. But actually my framing of the question is wrong. What i want is, when the filechooser window pops up on clicking of "Browse" button, i need the file chooser popup to show only "*.xlsx" files. But now it is showing all types of files.

Hope i have made myself clear. Any help regarding this would be greatly appreciated.

Thanks and Regards,

Santosh Giri

Former Member
0 Kudos

HI,

I don't think that is possible to filter the extensions in the upload dialog.

The upload dialog is controlled by the browser, not by WebDynpro.

I think the only way is to check the extension after the upload.

But I'm not to 100% percent sure, if the new browsers have the feature to limit the extension in the upload dialog.

Best regards,

Peter

Former Member
0 Kudos

HI,

Even I dont think so that it is possible to filter the resource before uploading. once the resource is stored in local context you can filter and accept or reject to send it to server. correct me if i am worg or if there is any other way to do the same.

Regards

Jeetendra