🎉 🎉 RAPIDMINER 9.10 IS OUT!!! 🎉🎉
Download the latest version helping analytics teams accelerate time-to-value for streaming and IIOT use cases.
Upload file using a Rapidminer Server Web App
How can I upload a file (e.g. an Excel file) from my computer and process the results directly in RapidMiner Server?
Here is what you need:
- RapidMiner Server up and running
- The Text processing extension (on Server and on Studio)
- Being able to create a Webservice from a RapidMiner process. See article How to create a webservice for details.
The solution in short:
- Create an HTML form which includes an input tag with type="file" and display it as a Web App visualization component
- Send the file via HTTP-Post to a RapidMiner process which has been published as a web service
- Store / Process the file and provide a success message
The solution in detail:
Using the special user "anonymous" makes the functionality much more convenient. This way the user who uploads the file does not need to reauthenticate himself for the upload. Therefore "anonymous" needs to have at least permission to execute within the folder in which the described processes are stored. See article Create and Manage "Special Users" for further information.
In this case you need to grant the user anonymous the execute permissions for the folder where the processes are stored. If you want to store data, the user also needs the permission to write.
In addition you need to adapt the action URL. You need to include the keyword "public" between "rest" and "process" (http://localhost/api/rest/public/process/<web service name>)
- Create a folder in which you want to store the processes (and uploaded data if you wish) on the server.
- Now create the process which receives the uploaded file and processes it. The attached example process "Read file from web app - webservice" receives either one or two excel file(s) and stores them in the repository. Then it sends a success message.
- This process needs to be exported as webservice as described in the article How to create a webservice. Make sure that you have set the Output format to "HTML" and the MIME Type to "text/html".
- Create the process displaying the HTML form and set the Webservice URL as the value for the form "action" (see attached example process).
- Create the Upload component as "New visualization" component in your RapidMiner Server Web App.
- Make sure that you have set the Output format to "HTML" and the MIME Type to "text/html".
What are constraints of this feature?
- If you enable the upload of multiple files at once (by using the keyword "multiple" in the HTML tag for the the input type="file") and you want to store them as one exampleset you have to ensure that the structure of the uploaded files is the same.
- You can only upload as many files at once as you have input ports connected.
- The operator "Publish to App" does not work in webservices since it is executed in a different session.
I just uploaded new process versions which already store each uploaded file with the original name as well as the full file.
The webservice now also makes use of the Handle Exception Operator which helps you to deal with problems.
I just uploaded a new process version for the HTML form. It includes a version of the HTML form with which you can rename the file(s) you upload. Only works for single file uploads.
Output of example process "Read file from web app - HTML form"
If you have selected a file for upload - the name is displayed
Success message (output of the example process "Read file from web app - webservice")