View comments | RSS feed

postData (FileReference.postData property)

public postData : String

POST parameters to submit with the upload or download.

Availability: ActionScript 1.0; Flash Player 8

See also

upload (FileReference.upload method), download (FileReference.download method)


Flash CS3


Comments


derRaab(); said on Aug 17, 2007 at 8:23 AM :
FileReference.postData is NOT contained in Flash 8 versions of the
class "flash.net.FileReference".
That's why the compiler will throw an error when compiling for Flash
Player 8!

This code-snipped will work anyway:

1. import flash.net.FileReference;
2. var fileRef: FileReference = new FileReference();
3. fileRef[ "postData" ] = "variable1=Value1&variable2=Value2&";

Please also take notice about the usage of FileReference.postData! It
works like a GET string but seems to be sent by POST. ???
TimTee said on Feb 18, 2008 at 9:27 PM :
it would be nice to see an actual example of the usage for this. Hmmm?
Adobe?
MaxoBonjo said on Apr 3, 2008 at 5:20 AM :
Yo! postData works such way:

Code in AS:

In onSelect handler of FileReference:

---
file.postData = "test1=1&test2=2";
file.upload(script_URL);
---

And then, in that script which receives a file, I gain access to such post data (it's using PHP):

---
$_FILES['Filedata'] - this is link to file and it properties
$_POST['postData'] - NULL, do not use it!!!
$_POST['test1'] ---- 1
$_POST['test2'] ---- 2
---

So, I don't know, who parses postData string intro vars and values - flash or php, but variables are accessible that way.
No screen name said on Apr 12, 2008 at 9:37 AM :
Hello,

thought I'd chip in a bit ...

I can confirm that
fileRef[ "postData" ]
does not break when rendering to Player 8.

However - when running the movie in Flash Player 8 (albeit standalone), the $_POST["variablename"] is not available.
So basically - from what I gather until now - using postData as a property of FileReference class does not work in Flash Player 8.

This also means that you might as well just use dot notation as in FileReference.postData - since you'll need FP9 in any case - to my knowledge?

It's a bit of a weird thing, this postData property - I find it weird at least, bit of a tack-on, no?

Anyways - if you're using FP9 you should be set, from what I found out.
No screen name said on Apr 12, 2008 at 10:00 AM :
I forgot to mention something else as well:

in the case of sending one form with POST data as a file form field with FileReference, is there any way of returning a success state or anything similar to the FileReference class?

It would be nice if you can dress up your page giving feedback as to the state of the data you sent along with FileReference.postData.

Fi. name and first name are sent along with a file.

The method onComplete tells you when everything has arrived properly, and whether the file was uploaded. But how can the server script send back that the database was populated properly, and all is well (or not, eventually?)

Any thoughts are most welcome.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00001675.html