FileReference.upload()不上传本地 [英] FileReference.upload() doesn't upload locally

查看:458
本文介绍了FileReference.upload()不上传本地的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用Flash的SWF在我的IIS和PHP 5.3的安装。

Trying to upload using flash swf on my local machine running Windows with IIS and PHP 5.3 installed.

var selected_file:FileReference = GetSelectedFile();
var url:String = 'http://localhost.com/upload.php';
var req:URLRequest = new URLRequest(url);
req.data = new URLVariables('source=' + 'computer');
req.method = URLRequestMethod.POST;
selected_file.upload(req, 'file', false);

selected_file.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, UploadComplete, false, 0, true);
selected_file.addEventListener(ProgressEvent.PROGRESS, UploadProgress, false, 0, true);
selected_file.addEventListener(IOErrorEvent.IO_ERROR, UploadError, false, 0, true);
selected_file.addEventListener(SecurityErrorEvent.SECURITY_ERROR, UploadSecurityError, false, 0, true);

我设置的所有处理函数断点。我打在上传进度处理程序中的断点。然而,该文件没有被上传。当看到网络流量有upload.php的没有调用

I've set breakpoints on all the handler functions. I hit a breakpoint on UploadProgress handler. However, the file isn't being uploaded. When looking at network traffic there is no call to upload.php.

看着<一href="http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7c60.html"相对=nofollow>对FileReference文件上传功能,我看到这样的:

Looking at documentation for FileReference upload function I see this:

上传和下载,如果调用的SWF文件中不允许   只能与本地文件系统沙箱

Uploads and downloads are not allowed if the calling SWF file is in the local-with-filesystem sandbox

综观<定义href="http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e3f.html#WS5b3ccc516d4fbf351e63e3d118a9b90204-7c8f"相对=nofollow>与本地文件系统沙箱我发现这一点:

从这个沙箱,可执行code可以读取本地文件(通过使用   URLLoader类,例如),但不能与网络进行通信   以任何方式。这保证了本地数据不能泄漏出用户   到网络或以其它方式不适当地共享。

From this sandbox, executable code can read local files (by using the URLLoader class, for example), but cannot communicate with the network in any way. This assures the user that local data cannot be leaked out to the network or otherwise inappropriately shared.

这是否意味着没有办法来测试本地计算机上传?

Does this mean there isn't a way to test uploads on local machine?

更新:按说我需要有<一个href="http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e3f.html#WS5b3ccc516d4fbf351e63e3d118a9b90204-7c52"相对=nofollow> Security.sandboxType 为 LOCAL_TRUSTED 。我一直在试图通过添加配置文件用户和<一href="http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7c95.html#WS357943C4-11D4-4b2a-ADAD-3B485BF39CBF"相对=nofollow>全球。配置文件中有 CFG 扩展,包含夹我的swf文件所在一行路径。

update: Supposedly I need to have Security.sandboxType as LOCAL_TRUSTED. I've been trying to set security type by adding configuration file for user and globally. Configuration file has cfg extension and contains one line, path to folder where my swf file resides.

不过添加此配置后,Security.sandboxType设置为远程。

Still after adding this configuration, Security.sandboxType is set to "remote".

推荐答案

<一个href="http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e3f.html"相对=nofollow>据到Adobe:

在与本地文件系统沙箱 - 出于安全考虑,Flash播放器放置到与本地文件系统沙箱中的所有本地SWF文件和资产,在默认情况下。从这个沙箱, SWF文件可以读取本地文件(使用URLLoader类,例如),但是它们可以与网络中的任何无法通信。这保证了本地数据不能泄漏到网络或以其它方式不适当地共享用户

The local-with-filesystem sandbox—For security purposes, Flash Player places all local SWF files and assets in the local-with-file-system sandbox, by default. From this sandbox, SWF files can read local files (by using the URLLoader class, for example), but they cannot communicate with the network in any way. This assures the user that local data cannot be leaked out to the network or otherwise inappropriately shared.

您无法访问文件系统网络中的SWF例如在正常情况下。

You cannot access the file system and network within one SWF instance in normal situations.

不过,这似乎是可以通过添加文件到本地信任的沙箱授予此能力的一个具体的SWF。 根据Senocular,这可以在三种不同的方式来实现...

However, it appears to be possible to grant this ability to a specific SWF by adding the file to the local trusted sandbox. According to Senocular, this may be accomplished in three different ways...

      
  • 的Flex Builder 2或Flash创作环境
  • 中运行的SWF   
  • 在位于目录主权财富基金的用户授予权限,从(仅在线)全局安全设置面板。
  •   
  • 位于本地系统上的Flash Player信任配置(.cfg)文件中指定的目录中的SWF
  •   
  • SWFs run within Flex Builder 2 or the Flash Authoring environment
  • SWFs located in a directory the user has granted permissions for from the (online only) Global Security Settings Panel.
  • SWFs located in a directory specified in a Flash Player trust configuration (.cfg) file on the local system

对于配置文件选项:

  1. 您需要使用本地播放设置选择编译的SWF。

这意味着你需要把你的配置文件 C:\ WINDOWS \ SYSTEM32 \ Macromed \闪存\ FlashPlayerTrust中\ 如果该文件夹不存在,则必须创建它。

This means you need to place your configuration file in C:\Windows\System32\Macromed\Flash\FlashPlayerTrust\ If the folder doesn't exist you must create it.

这篇关于FileReference.upload()不上传本地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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