Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

upload file with .NET Webservice
Started by kakula Sep 01 2019 03:45 PM

1 reply to this topic
upload .net web service webservice php
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

kakula

[GLOBAL: userInfoPane.html]
kakula
  • Enthusiast

  • 98 posts
  • Corona SDK

i asked this question long ago

 

i managed to upload files with corona based on a php webservice ... it worked perfectly

 

i couldn't do the same with a .NET webservice which worked fine with postman

 

not sure what i was doing wrong...

 

the weird thing is that corona didn't say it is not working ... it showed success, but file just doesn't appear on the server

 

did anyone try the same and made it work?



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,062 posts
  • Enterprise

Unfortunately we don't have any experience working with .NET services. I understand PHP and how that works, but I couldn't start with .NET.

 

Speaking in general HTTP terms, which .NET should conform to, I believe the network.upload() API basically does an HTTP PUT. You will get a request URI and then the file will be dumped into the input stream of the HTTP request.  Now depending on the server side, you may need to BASE64 encode the file before you send it and then BASE64 decode it on the other side and take the output from that and write a file to a folder you have permission to.

 

There is a way to use the MIME type of application/x-www-form-urlencoded with HTTP POST requests. This is the way normal web forms post form data to servers. Files can be uploaded this way, but you would have to figure out the whole form encoding protocol:

 

https://dev.to/sidthesloth92/understanding-html-form-encoding-url-encoded-and-multipart-forms-3lpa

 

Someone once came up with a Corona module that lets use use this method. I think the source is on GitHub somewhere.

 

.NET should certainly  support application/x-www-form-urlencoded 

 

Rob




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: upload, .net, web service, webservice, php