如何上传直BitmapData对象到我的服务器? [英] How to upload a BitmapData Object straight to my server?

查看:179
本文介绍了如何上传直BitmapData对象到我的服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的Flash应用程序(AS3)来imageshacks XML API上传。我想知道我可以做到这一点。

I wish to upload from my Flash Application (AS3) to imageshacks XML API. I wish to know how I can do this.

在Flash中,我们必须张贴使用URLRequest和URLLoader类的数据,但我们碰到了闪存API的限制。一个URLRequest的数据属性可以是一个UrlVariablesByteArray对象。有没有简单的方法来发送名称值随着JPG字节数组对。这是一个很大的问题,因为大多数上传应用程序将需要一个文件名等标题陪原始文件数据

"In Flash, we must POST the data using the UrlRequest and UrlLoader classes, however we run into a limitation of the Flash API. The data property of a UrlRequest can either be a UrlVariablesByteArray object. There is no easy way to send name value pairs along with the JPG byte array. This is a big problem, because most upload applications will require a filename and other headers to accompany the raw file data"

我希望,如果有人可以帮助我克服了以上!

I was hoping if someone could help me overcome the above!

感谢所有

我曾尝试利用本教程在这里:<一href="http://www.mikestead.co.uk/2009/01/04/upload-multiple-files-with-a-single-request-in-flash/">http://www.mikestead.co.uk/2009/01/04/upload-multiple-files-with-a-single-request-in-flash/

I have tried making use of this tutorial here:http://www.mikestead.co.uk/2009/01/04/upload-multiple-files-with-a-single-request-in-flash/

现在的问题是它不是未保存的图像,但它从本地机器上获取的图像,然后将其上传到图像已经有一个名字已经在服务器!

The problem is it's not for unsaved images, but it get images from your local machine and then uploads it to the server where the images has had a name already!

推荐答案

这是对我帮助很大:的 http://kitchen.braitsch.io/upload-bitmapdata-snapshot-to-server-in-as3/

This was of great help to me: http://kitchen.braitsch.io/upload-bitmapdata-snapshot-to-server-in-as3/

您需要修改URLRequestWrapper在需要的地方插入字段名和文件名。下面是我做了什么:

You need to modify the URLRequestWrapper to insert field names and file names where needed. Here's what I've done:

bytes = 'Content-Disposition: form-data; name="' + $fieldName + '"; filename="';

它做头的最格式,这样服务器可以把它理解为一个文件上传。

It does the most formatting of headers so the server could understand it as a file upload.

顺便说一句,如果你有一个的BitmapData您可能需要连接code到JPEG或PNG第一。

By the way, if you have a BitmapData you might need to encode it to JPEG or PNG first.

问候, 阿尔乔姆

这篇关于如何上传直BitmapData对象到我的服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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