Home > Notes & XPages > XPages: FileUpload Control – replace filename

XPages: FileUpload Control – replace filename

Today only a little advice.

I had the problem that some uploads failed in an application from time to time. I have used the standard FileUploadControl.

Unfortunately, the error wasn’t really reproducable, therefore I had to do some experiments.

A possible reason for this error were umlauts (we have them in germany, Ä, Ö, Ü) in the filename.

You can change the filename with a standard function of the control, it’s called “Replace file name of uploaded file with the following name”. You can find it in the main properties of the control.
You can also compute that, that works with the following code:

var path:com.ibm.xsp.http.UploadedFile = getComponent("fd_file").value;
var newPath:string = path.getClientFileName();

newPath = newPath.replace("Ä", "ae");
newPath = newPath.replace("Ö", "oe");
newPath = newPath.replace("Ü", "ue");
newPath = newPath.replace("ä", "ae");
newPath = newPath.replace("ö", "oe");
newPath = newPath.replace("ü", "ue");

return newPath;

There nothing special about that, except the class com.ibm.xsp.http.UploadedFile. This class is, in good old IBM manner, not documented. This class gives you some nice possibilities to access the uploaded file, before it is saved in a document.

Here is another interesting article about this topic: XPagesWiki


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: