I have a zip file that is created using drag and drop in a view on my Flex 4.6 desktop.
This starts a service that automatically downloads the zip file.
I can use the following code to send metadata about the zip file to the server.
var urlRequest:URLRequest = new URLRequest(PUBLISH_ZIP_FILE_URL); // set to method=POST urlRequest.method = URLRequestMethod.POST; var params:URLVariables = new URLVariables(); params['data[File][title]'] = 'Title1'; params['data[File][description]'] = 'desc'; // params['data[File][filename]'] = I am not sure exactly what to use here // If this is a webpage, I expect to use input type="file" with the name as data[File][filename] urlRequest.data = params; addLoaderListeners(); // set it such that data format is in variables loader.dataFormat = URLLoaderDataFormat.VARIABLES; loader.load(urlRequest);
I read https://stackoverflow.com/questions/8837619/using-http-post-to-upload-a-file-to-a-website
However, right away they start with ByteArray, and I'm not sure how to convert a zip file at all.
Please inform.
source share