Reputation: 1751
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference.html
How do I add my own request header to the POST requests generated by FileReference.upload()?
Upvotes: 2
Views: 2156
Reputation: 31
You can UrlRequest as before but you use a helper class to send the content of the file. Here is the answer:
https://stackoverflow.com/a/12933681/1753025
Upvotes: 0
Reputation: 2216
Just had a same problem, use file upload via URLLoader
, and use zehs solution to setup headers.
Just put your file inside of request.data
, and setup method to POST.
Upvotes: 0
Reputation: 23702
In short, no.
From the docs:
The requestHeaders property of the URLRequest object is ignored; custom HTTP request headers are not supported in uploads or downloads.
EDIT: just fixed some specifics.
Upvotes: 1
Reputation: 10659
Have you tried created an URLRequest with its own URLRequestHeader entries?
var request:URLRequest = new URLRequest("http://www.example.com/post.php");
request.method = URLRequestMethod.POST;
var header:URLRequestHeader = new URLRequestHeader("pragma", "no-cache");
request.requestHeaders.push(header);
fileRef.upload(request);
Upvotes: 1