Created by Jerry Wang, last modified on Sep 23, 2014

After selecting local file with the Fileupload control, click Stash the File to upload:



The form fields in the HTTP Request header received by ABAP are as follows:



The complete HTTP request received on ABAP is downloaded to the local computer as follows:

Source code is as follows:

<html> <form enctype="multipart/form-data" method="post" name="fileinfo"> <label>Your email address:</label> <input type="email" autocomplete="on" autofocus name="userid" placeholder="email" required size="32" maxlength="64" /><br /> <label>Custom file label:</label> <input type="text" name="filelabel" size="12" maxlength="32" /><br /> <label>File to stash:</label> <input type="file" name="file" required /> </form> <div id="output"></div> <a href="javascript:sendForm()">Stash the file! </a> <script> function sendForm() { var oOutput = document.getElementById("output"); var oData = new FormData(document.forms.namedItem("fileinfo")); oData.append("CustomField", "This is some extra data"); var oReq = new XMLHttpRequest(); oReq.open("POST", "https://ag3:44354/sap/crm/file_upload", true); oReq.onload = function(oEvent) { if (oReq.status == 200) { oOutput.innerHTML = "Uploaded!" ; } else { oOutput.innerHTML = "Error " + oReq.status + " occurred uploading your file.<br \/>"; }}; oReq.send(oData); } </script> </html>Copy the code