private function save():void{
Alert.show("是否保存图片?","提示",3, this, function(event:CloseEvent):void {
if (event.detail==Alert.YES){
var request:URLRequest = new URLRequest("http://localhost:8080/imagetest/SavePic?realPath="+encodeURIComponent(StringUtil.trim(realPath)));
request.method=URLRequestMethod.POST;
request.contentType = "application/octet-stream";
request.data = new JPEGEncoder(50).encode(ImageSnapshot.captureBitmapData(img));
var loader:URLLoader = new URLLoader();
loader.load(request);
loader.addEventListener(Event.COMPLETE,saveResult);
}});
}
private function saveResult(event:Event):void{
Alert.show("保存图片成功","提示");
}后台用servlet:
response.setContentType("application/octet-stream");
InputStream is = request.getInputStream();这样能保存一张图片到服务器端,现在我想实现多张图片保存到服务器上,请问各位大虾有啥好的建议没?我除了想到一个ongoing循环保存,没想到别的,初学felx,请各位帮帮忙,提供个思路.谢过了
当时是在后台用循环做的,估计楼主的也跑不掉循环。