1 Reply Latest reply: Mar 8, 2013 3:25 AM by rajesh_android RSS

    Upload files on REST api using PUT method

    rajesh_android

      Does anyone know how to upload files on REST API ? I have tried a lots n lots of link s and codes but no luck.

       

      I want to upload files on REST API from my mobile application. my stuck and confused between filereference.upload, urlLoader.load(urlRequest), httpService.send().

       

      None of the above method seems to be working for me....

       

      private function onFileSelect(event:Event):void{

                      newfile.removeEventListener(Event.SELECT, onFileSelect);

                      newfile = File(event.currentTarget);

                 

                      var vars:Object = new Object();

                     

                      var urlloder:URLLoader = new URLLoader();

                 

                      fileRef = new FileReference;

                     

                      urlRequest.method = URLRequestMethod.PUT;

                      urlRequest.requestHeaders = new Array(new URLRequestHeader("X-Auth-Token", mytoken));

                                     

                      urlRequest.data = newfile;

                     

                     urlRequest.url = "myrestapi;

                     

                      urlloder.load(urlRequest);

       

      }