Uploading a file from a HTML client to a server

One Star

Uploading a file from a HTML client to a server

Hi,
which is the best component to use to upload a file from a HTML / web browser client and to store it on the server for further processing by Talend? I am looking for the Talend equivalent to the usual PHP or CGI scripts, that process files sent by HTML file forms.
Many thanks in advance!
Markus
Moderator

Re: Uploading a file from a HTML client to a server

Hi,
If you want to upload file with Talend,  pleaswe try to use tFileFetch component ( POST + upload file ).
Feel free to let us know if it is OK with you.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Employee

Re: Uploading a file from a HTML client to a server

Also, tRESTRequest can accept HTTP form uploads and the multipart attachments in general
Cheers, Sergey
One Star

Re: Uploading a file from a HTML client to a server

Many thanks! Can you help me with some details for the tRESTRequest option?
I managed to write a HTML form that successfully sent a POST to my tRESTRequest component.
How can I process the entire file to e.g. save it or import it into a database?
I built a job to save the file. It executed without error, even wrote a file, but it was empty rather than containing the content of the uploaded file. I managed to process individual strings withtRESTRequest, like shown in your documentation, but how to best deal with the entire uploaded file?
I use the following following HTML form:

<!DOCTYPE html>
<html>
<body>
<form action="http://localhost:8088/Test" method="post" enctype="multipart/form-data">
    Select image to upload:
    <input type="file" name="fileToUpload" id="fileToUpload">
    <input type="submit" value="Upload Image" name="submit">
</form>
</body>
</html>
This is how my tRESTRequest is configured in my job

Many thanks in advance!
One Star

Re: Uploading a file from a HTML client to a server

Myself strucked with same problem??
any help to solve this guys??
One Star

Re: Uploading a file from a HTML client to a server

One Star

Re: Uploading a file from a HTML client to a server

FileFetch works well for a Transaction to fetch files from another server, but (to my understanding) is not capable to let a user upload files to a Server via a web interface.  tRESTRequest should be the one to build a transaction for such a task (in combination with a HTML upload form), but I did not get it working.
I now use the free HFS http fileserver, that can be easily embedded in web pages, to have users uploading files from their local computer to my Talend Server and manage them there conveniently. The Talend transaction subsequently processes files located on the Talend server.
I would still appreciate a working tRestRequest & HTML form based file Transfer example, just in case someone gets it working.
One Star

Re: Uploading a file from a HTML client to a server

i need to do this with 'tRESTRequest ' ??
Team any help to accomplish this task using 'tRestRequest'??
This is my exact requirement so i am rushing.
One Star

Re: Uploading a file from a HTML client to a server

As far I know, the multipart requests (file uploads) are not supported by any DI (data integration) flow components, so you cannot just upload a file directly from the HTML page into the DI job. You have to store the file locally and then process it. However - you may still build a REST endpoint using the CXF framework and then invoke an integration route or any Talend job. See https://help.talend.com/search/all?query=Forms+and+multiparts&content-lang=en
g.