0
我們嘗試上傳文件並從Flash應用程序提交參數到ASP.Net MVC2控制器。基本上,雖然這只是簡單地創建一個標準的多部分/形式的職位與文件和張貼參數。asp.net mvc2文件和表單值閃存
在控制器:
public string Upload(HttpPostedFile file, string someString,
int someInt, DateTime someDate)
{
// some code
return "success";
}
而且從閃存(柔性):
var file : FileReference = "C:\someFile.txt";
var urlRequest: URLRequest = new URLRequest("http://localhost/MySite/Uploader/Upload");
urlRequest.method = URLRequestMethod.POST;
var variables:URLVariables = new URLVariables();
variables.someString = "test";
variables.someInt= 1;
variables.someDate = "01/01/2011 00:00:00";
urlRequest.data = variables;
file.upload(urlRequest, "file");
控制器被實例化,但該方法沒有找到,只要我們發佈文件,而無需額外的params它工作正常,我們也可以得到它與文件和someInt參數,但沒有別的?
我會打賭一些關於AS安全,也許增加`security.allowdomain(「網站」,「IP」);`? – balexandre 2011-01-07 15:52:30