Get a file from an input file


I am working with a input file control in order to read a excel file. I write this code:

<form id="formuploadfile" method="post" data-th-action="${postUrl}" enctype="multipart/form-data">
		<span data-th-utext="${textouploadtitulo}" ></span>		
		<input  id="inputfileexcel" name="inputfileexcel" type="file" ></input>		
		<input type="submit" name="send" value="submit"></input>						

But when I try to obtain the file int the controller I can’t. The parameter “inputfileexcel” is undefined. In addition, the req object doesn’t have the file

function handlePost(req) {

How could I get this file on the controller?

Thank you for your help

Hi Diego,

It should be in the req.params.inputfileexcel or maybe file uploads is not supported. I think an earlier version of XP had problems with enctype=“multipart/form-data” but that should be fixed by now. One of our developers will have to answer this.


We have not yet added upload functionality to JS-part of the solution. It’s going to be added in 6.3 which is scheduled for release before crhistmas.

@srs Is file upload implemented in 6.3.1 ?


Support for files and multipart forms is in 6.4.0-SNAPSHOT. The official 6.4.0 release is almost ready.

Check the new portal functions.!/module-lib_xp_portal.html#.getMultipartForm

Thanks, Works :smile:

First version of multipart handling was released in 6.3 - there are some fixes in 6.4