Skip navigation
rajesh_android
Currently Being Moderated

Upload files on REST api using PUT method

Jan 21, 2013 12:24 AM

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);

 

}

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points