NetTalk Central

Author Topic: Webservice - How to upload a file  (Read 2548 times)

debraballenger

  • Newbie
  • *
  • Posts: 49
    • View Profile
    • Email
Webservice - How to upload a file
« on: November 11, 2013, 07:01:43 AM »
Hi All,

How do I handle uploading a file via a webservice?

Thanks,

Debra

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11242
    • View Profile
Re: Webservice - How to upload a file
« Reply #1 on: November 11, 2013, 10:26:03 AM »
bit more context please Debra... are you wanting to be the client to a web service? and that service wants you to send a file?
Via a POST statement?

cheers
Bruce

debraballenger

  • Newbie
  • *
  • Posts: 49
    • View Profile
    • Email
Re: Webservice - How to upload a file
« Reply #2 on: November 11, 2013, 11:06:25 AM »
I want my NT Webservice to accept a file upload from a POST statement.   But I am not sure how to actually handle that in my procedure.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11242
    • View Profile
Re: Webservice - How to upload a file
« Reply #3 on: November 11, 2013, 09:08:59 PM »
Hi Debra,

Basically you want to create a NetWebForm. On that form have a File-Upload field (plus any other fields which will be posted at the same time.) And I think set the "Use HTML5 Uploader" option for the File Upload field off.

At this point the server will accept the file. And (depending on your options chosen, and embed code etc) will save the incoming file into the Uploads folder for you.

On the client side you can use a NetWebClient to construct the POST - or whatever. The POST is a normal POST.

Of course that's transferring the file in an HTTP "POST" format. There are other ways of doing it. For example, you might upload the file as a field in an XML packet - certainly that's do'able - but you would then process it on the server side slightly differently.

Cheers
Bruce