formData.append(uploadfiles[j].paperType, uploadfiles[j].data);
}
//添加其他
formData.append("paperTitle", "testtesttest");
formData.append("paperAuthor", "author1,author2");
$.ajax({
type: 'POST',
url: '/Home/SciPaperSave',
data: formData,
dataType: 'json',
contentType: false,
processData: false,
success: function (response) {
},
error: function (error) {
}
});
Controller:
Function SciPaperSave() As JsonResult
Dim rootPath = Server.MapPath("/UploadFiles/" + CStr(Now.Year) + "/teacherID")
''''''''获取formdata里面的文件列表
Dim loop1 As Integer
Dim arr1() As String
Dim Files As HttpFileCollection
Files = System.Web.HttpContext.Current.Request.Files
arr1 = Files.AllKeys
For loop1 = 0 To arr1.GetUpperBound(0)
Dim myFile = New HttpPostedFileWrapper(Files(loop1))
myFunctions.myUploadFile(rootPath, myFile)
Dim fileType = arr1(loop1)
Next
''''''''获取formdata里面非文件列表
Dim paperParmeters As NameValueCollection = System.Web.HttpContext.Current.Request.Form
Dim arr2() As String = paperParmeters.AllKeys
For loop1 = 0 To arr2.GetUpperBound(0)
'do something
Next
Threading.Thread.Sleep(5000)
Return Json(New With {.statusCode = 200, .status = "Bad Request! Upload Failed", .file = String.Empty}, JsonRequestBehavior.AllowGet)
End Function