NativeScript / nativescript-background-http

Background Upload plugin for the NativeScript framework
Apache License 2.0
101 stars 50 forks source link

Error during upload #171

Closed joey0xx closed 5 years ago

joey0xx commented 5 years ago

If the demo apps cannot help and there is no issue for your problem, tell us about it

Im trying to upload a video (or any file) to a C# dotnet api. When its uploading it shows the progress on the status bar but when it gets to 100%, it shows an error saying 'Error during upload'. I tried debugging the api and the request doesnt go through, but sending the request with the http module it does go through.

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

Describe the steps to reproduce it.

Is there any code involved?

joey0xx commented 5 years ago

Update: now im the http error code 415

tgpetrov commented 5 years ago

Hi @joey0xx With the provided information I am not able to reproduce the issue. I downloaded your application and replaced "url goes here" with the url used in the plugin's demo application. I was able to successfully upload a 55MB video in mp4 format.

joey0xx commented 5 years ago

Hello @tgpetrov thank you for the response.

I was able to fix the problem earlier, the issue was in the api.

For anyone who might run into this problem using a dotnet core C# api, this is what i did:

[HttpPost()]
public async Task<IActionResult> UploadFile()
{
      var form = Request.Form;

      //gets the files that were sent in the request
      var file = form.Files;

      //create a dictionary that maps the name of the parameter and the value
      var keyValueParams = form.ToDictionary(x => x.Key, x => x.Value.ToString());

      //do whatever else you need to do 
}

used this post as reference: http://www.talkingdotnet.com/upload-file-angular-5-asp-net-core-2-1-web-api/

ashhadaimviz commented 4 years ago

@joey0xx bro? Can you help me I am sending an Image to .net core api but getting exception at request.Form (Invalid operator) each time!