NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: debzidoodle on July 02, 2014, 12:31:06 PM
-
Hi All,
How can I upload a picture or file to a WebServiceMethod? Ideally I would like to be able to upload more than one file at a time, but not required.
It does not have to be done via a WebServiceMethod, but I am a little confused by this post http://www.nettalkcentral.com/index.php?option=com_smf&Itemid=36&topic=5150.0
The part that confuses me is using the web page, so do I create by own form in a routine? And if so how do I access the values and file upload from the form?
Thanks
Debra
-
Hi Debra,
create NetTalkPage and declare ST as a StringTheory object after that in page embed put code like this
ST.SetValue(p_web.GetValue('_postdata_'))
ST.SaveFile('WHENEVERYOUWANT\WHATEVERYOUWANT.BIN')
Then with that file do it what you want. :)
Best regards,
Djordje Radovanovic
-
>> How can I upload a picture or file to a WebServiceMethod?
Because it's a webServiceMethod I presume you are uploading from a client which is not a Browser.
so there are 2 directions to take, based on the Client's method of choice.
a) do a POST from the client, including the file using "normal http post" techniques (which in say a NetTalk Web client means doing a
net.SetValue(fieldname,filename,true) [ from memory - so I don't know if the syntax is correct. ]
or
b) embed the file inside the incoming XML as a parameter, usually base64 encoded or something.
In the case of a) you can follow the instructions on the other thread - the incoming file is just in a Value.
In the case of b) you'd make the field a large string parameter (like any other parameter) and then you'd need to decode it and save it (probably using StringTheory.)
Cheers
Bruce
-
Thanks Bruce and Djordje. With the explanation Bruce gave in the user group meeting #25 I got it worked out!
Thanks
Debra