User Guide

FileReference (flash.net.FileReference) 581
The file is uploaded to the URL passed in the url parameter. The URL must be a server script
configured to accept uploads. Flash Player uploads files using the HTTP
POST method. The
server script that handles the upload should expect a
POST request with the following
elements:
A Content-Type element of multipart/form-data
A Content-Disposition element with a name attribute set to "Filedata" and a
filename attribute set to the name of the original file
The binary contents of the file
Here is a sample
POST request:
Content-Type: multipart/form-data; boundary=AaB03x
--AaB03x
Content-Disposition: form-data; name="Filedata"; filename="example.jpg"
Content-Type: application/octet-stream
... contents of example.jpg ...
--AaB03x--
You can send data to the server with the upload() call by appending parameters to the URL.
Note: If your server requires user authentication, only SWF files running in a browser—that
is, using the browser plug-in or ActiveX control—can provide a dialog box to prompt the user
for a user name and password for authentication, and only for downloads. For uploads that
use the plug-in or ActiveX control, and for uploads and downloads that use the stand-alone or
external player, the file transfer fails.
When using this method, consider the Flash Player security model:
Not allowed if the calling SWF file is in an untrusted local sandbox.
The default is to deny access between sandboxes. A website can enable access to a resource
by adding a cross-domain policy file.
For more information, see the following:
Chapter 17, "Understanding Security," in Learning ActionScript 2.0 in Flash
The Flash Player 8 Security white paper at http://www.macromedia.com/go/fp8_security
The Flash Player 8 Security-Related API white paper at http://www.macromedia.com/go/
fp8_security_apis
Availability: ActionScript 1.0; Flash Player 8
Parameters
url:String - The URL of the server script configured to handle upload through HTTP
POST calls. The URL can be HTTP or, for secure uploads, HTTPS.