Flex HTTPservice 和 POST,发送文件? [英] Flex HTTPservice and POST, Sending Files?

查看:34
本文介绍了Flex HTTPservice 和 POST,发送文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用基本的 Post 将数据发送到 Django 服务器.

I use a basic Post to send data to a Django server.

数据由 flex 动态创建的 base64 编码的 640*380 PNG 图像组成组件.

The data consists of a base64 encoded 640*380 PNG image dynamically created by the flex component.

<mx:HTTPService id="formSend" showBusyCursor="true" 
    useProxy="false" url="http://127.0.0.1/form/" 
    method="POST" result="formSentConfirmation(event)"    fault="formSendingFailed(event)"/>



private function sendForm(url:String, message:String, meteo:Number):void {
    formSend.url = url;
    var params:Object = { message: message, image_data: getEncodedImage() }; 
    snapButton.label = "sending ...";
    formSend.send(params);
}

在服务器端我可以看到数据在 request.POST不在 request.FILES 中.这意味着图像不会作为带有多编码 HTTP 的文件发送.

On the server side i can see that the data is in the request.POST not in request.FILES. That means the image is not send as a File with multiencode HTTP.

  1. 我会在真正的服务器上遇到麻烦吗?因为 urlencoded POST var 的限制是 200k.

  1. Will i get into trouble on a real server ? since the limit is 200k for urlencoded POST var.

如何让 HTTPservice 将数据作为文件发送?

How to make HTTPservice send the data as a file?

还有其他解决方案吗?

谢谢

推荐答案

  1. 可能吧.这取决于您是否对文件大小以及目标页面如何处理请求施加了硬限制.

  1. Probably, yes. It depends whether you impose a hard limit on the the file size and how the destination page handles the request.

我认为目前这不可能.

阅读 这个.FileReference 是推荐的文件上传方式.

Read this. FileReference is the recommended way of uploading files.

这篇关于Flex HTTPservice 和 POST,发送文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆