使用form上传文件到application server的另一种办法
生活随笔
收集整理的這篇文章主要介紹了
使用form上传文件到application server的另一种办法
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
Created by Jerry Wang, last modified on Sep 23, 2014
界面如下: 使用fileupload控件選擇local file后,點擊Stash the file上傳:
在ABAP端接收到的http request header里包含的form fields如下:
在ABAP端接收到的完整http request download到本地如下:
source code如下:
<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>總結(jié)
以上是生活随笔為你收集整理的使用form上传文件到application server的另一种办法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 抖音火山版怎么修改头像
- 下一篇: 使用report BSP_UPDATE_