Can't upload image from Gallery with request.Addfile on iOS

187 views Asked by At

I'm trying to upload an image from the Gallery got with UIPickerViewController, but using request.Addfile() gets an FileNotFound error. Is there anything wrong on what I am doing or is just impossible to do this way with iOS?

The code is as follows:

NSUrl referenceURL = e.Info[new NSString("UIImagePickerControllerReferenceUrl")] as NSUrl;

var request = new RestRequest("account/imageprofile/", Method.POST);
request.AddFile("path_picture",referenceURL.AbsoluteString);
request.AddHeader ("Authorization", "Bearer " + token);

client.ExecuteAsync(request, rsResponse)

Hope someone can help me with that because I can't find a solution for my problem anywhere..

Thanks in advance!

1

There are 1 answers

0
nothotscott On

I know I'm 3 years late, but for future reference to those who stumble upon this. Try

request.AddFile("path_picture",referenceURL.Path);