每次我尝试将图像从 flex 移动应用程序上传到 IIS 目录时都会遇到问题,并且此目录配置为 Web 应用程序我收到 HTTP 错误 405 'method not allowed' 因此我不使用来自服务器的任何脚本一边,我不想使用任何..
上传按钮的代码是
protected function getImage(event:Event):void
{
var image:Bitmap = Bitmap(event.target.content);
bitmapData = image.bitmapData;
byte = jpgEncoder.encode(bitmapData); // bytearray
uploadrequest = new URLRequest("http://localhost/ProblmeImages/");
var header:URLRequestHeader = new URLRequestHeader("Content-type","application/octet-stream");
uploadrequest.requestHeaders.push(header);
uploadrequest.method = URLRequestMethod.PUT;
uploadrequest.data = byte;
urlloader1.dataFormat = URLLoaderDataFormat.BINARY;
urlloader1.addEventListener(Event.COMPLETE,uploaded);
urlloader1.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS,displayerror);
urlloader1.load(uploadrequest);
}
protected function uploaded(event:Event):void
{
PopUpManager.removePopUp(Alert);
errormsg = "Done!";
var str:String = urlloader1.data;
PopUpManager.addPopUp(Alert,this,true);
PopUpManager.centerPopUp(Alert);
}
protected function displayerror(event:Event):void
{
errormsg = httpresponsemsg;
PopUpManager.addPopUp(Alert,this,true);
PopUpManager.centerPopUp(Alert);
}