Flex FileReference upload() 和 .data ...这会将整个文件加载到内存中吗?

发布于 2024-09-09 00:56:43 字数 315 浏览 7 评论 0原文

我需要通过 Flex 应用程序将一个非常大的文件上传到我的服务器,我发现 Flex Filereference upload() 似乎能够处理它。 upload() 方法是否将“流”上传到 servlet,还是发送整个 ByteArray(据我所知,ByteArray 将包含整个文件内容,因此大于 1Gb 的文件将淹没我的内存)。

我还没有找到其中之一的确认。看来flex.net.FileReference源代码是flash的一部分,而不是开源的flex,所以我不能偷看。

当向服务器发送文件内容时,任何人都可以确认或否认整个 byteArray 的使用吗?

谢谢

I need to upload a very large file to my server, through my Flex application, and I see that Flex Filereference upload() seems to be able to handle it. Does the upload() methods uploads a 'stream' to the servlet, or does it sends the whole ByteArray (As I understand it, the ByteArray will have the whole file contents, so a >1Gb file will flood my memory).

I haven't found confirmation of one or the other. It seems flex.net.FileReference source code is part of flash, not the open source flex, so I cant take a peek.

Anyone can confirm or deny the usage of the whole byteArray when sending file contents to the server?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

她如夕阳 2024-09-16 00:56:43

当尝试使用 Flash 上传大文件时,将文件加载到内存中并不是您最关心的问题 - 上传本身相当不可靠。根据Flex参考 Flash播放器正式支持上传文件大小最大为 100 MB。我的经验证实大文件上传经常失败。您可以检查这个文件上传组件来上传大文件出现裂缝并恢复部分上传。然而,该解决方案还需要在开始上传之前将文件完全加载到内存中。

When trying to upload big files using Flash, the loading of the file into memory is not your biggest concern - the upload itself is quite unreliable. According to the Flex reference Flash player officially supports upload file sizes of up to 100 MB. My experience confirms that big file uploads often fail. You may check this file upload component for uploading large files in chinks and resuming partial uploads. However this solution also needs to fully load the file into memory before starting the upload.

晚雾 2024-09-16 00:56:43

以下示例 HTTP POST 请求 如果未指定参数,则从 Flash Player 发送到服务器端脚本:

  POST /handler.cfm HTTP/1.1 
  Accept: text/*
  Content-Type: multipart/form-data; 
  boundary=----------Ij5ae0ae0KM7GI3KM7 
  User-Agent: Shockwave Flash 
  Host: www.example.com 
  Content-Length: 421 
  Connection: Keep-Alive 
  Cache-Control: no-cache

  ------------Ij5GI3GI3ei4GI3ei4KM7GI3KM7KM7
  Content-Disposition: form-data; name="Filename"

  MyFile.jpg
  ------------Ij5GI3GI3ei4GI3ei4KM7GI3KM7KM7
  Content-Disposition: form-data; name="Filedata"; filename="MyFile.jpg"
  Content-Type: application/octet-stream

  FileDataHere
  ------------Ij5GI3GI3ei4GI3ei4KM7GI3KM7KM7
  Content-Disposition: form-data; name="Upload"

  Submit Query
  ------------Ij5GI3GI3ei4GI3ei4KM7GI3KM7KM7--

它看起来类似于 post 请求由文件输入html控件生成。所以它不是 ByteArray,但浏览器仍然需要在发送文件之前将文件加载到内存中; 1GB 对于任何文件上传来说都太大了——无论是否是闪存。

The following sample HTTP POST request is sent from Flash Player to a server-side script if no parameters are specified:

  POST /handler.cfm HTTP/1.1 
  Accept: text/*
  Content-Type: multipart/form-data; 
  boundary=----------Ij5ae0ae0KM7GI3KM7 
  User-Agent: Shockwave Flash 
  Host: www.example.com 
  Content-Length: 421 
  Connection: Keep-Alive 
  Cache-Control: no-cache

  ------------Ij5GI3GI3ei4GI3ei4KM7GI3KM7KM7
  Content-Disposition: form-data; name="Filename"

  MyFile.jpg
  ------------Ij5GI3GI3ei4GI3ei4KM7GI3KM7KM7
  Content-Disposition: form-data; name="Filedata"; filename="MyFile.jpg"
  Content-Type: application/octet-stream

  FileDataHere
  ------------Ij5GI3GI3ei4GI3ei4KM7GI3KM7KM7
  Content-Disposition: form-data; name="Upload"

  Submit Query
  ------------Ij5GI3GI3ei4GI3ei4KM7GI3KM7KM7--

It looks similar to the post request generated by a file input html control. So it's not a ByteArray, but still the browser would need to load the file to its memory before sending it; 1GB is too much for any file upload - flash or not.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文