Note that there are some explanatory texts on larger screens.

plurals
  1. POFileReference.upload() doesn't upload locally
    primarykey
    data
    text
    <p>Trying to upload using flash swf on my local machine running Windows with IIS and PHP 5.3 installed.</p> <pre><code>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); </code></pre> <p>I've set breakpoints on all the handler functions. I hit a breakpoint on <code>UploadProgress</code> handler. However, the file isn't being uploaded. When looking at network traffic there is no call to <code>upload.php</code>. </p> <p>Looking at <a href="http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7c60.html" rel="nofollow">documentation for FileReference upload</a> function I see this:</p> <blockquote> <p>Uploads and downloads are not allowed if the calling SWF file is in the local-with-filesystem sandbox</p> </blockquote> <p>Looking at definition of <a href="http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e3f.html#WS5b3ccc516d4fbf351e63e3d118a9b90204-7c8f" rel="nofollow">local-with-filesystem sandbox</a> I found this:</p> <blockquote> <p>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.</p> </blockquote> <p>Does this mean there isn't a way to test uploads on local machine? </p> <p><strong>update:</strong> Supposedly I need to have <a href="http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e3f.html#WS5b3ccc516d4fbf351e63e3d118a9b90204-7c52" rel="nofollow">Security.sandboxType</a> as <code>LOCAL_TRUSTED</code>. I've been trying to set security type by adding configuration file <a href="http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7c91.html#WSD2DCB535-92C6-49ff-8954-D8D5130404F1" rel="nofollow">for user</a> and <a href="http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7c95.html#WS357943C4-11D4-4b2a-ADAD-3B485BF39CBF" rel="nofollow">globally</a>. Configuration file has <code>cfg</code> extension and contains one line, path to folder where my swf file resides. </p> <p>Still after adding this configuration, Security.sandboxType is set to "remote". </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload