tags:

views:

52

answers:

2

I have a web application. I am using C#. I have existing methods in my API for various things but all only submit and return bool/int/strings.

All of my API methods have the directive
System.ServiceModel.OperationContract
All the parameters are of
System.Runtime.Serialization.DataMember

I would like to be able to receive a posted file over HTTP. Apologies if this is a very simple question, but I'm not sure where to start so I don't know what to google. All I've been finding is people attempting to save a HttpPostedFile after submitting it in a form.

Thanks in advance for any help.


EDIT: this will be called from an iPhone application. Not via the browser on the iPhone
Basically, I would like to do this: http://www.flickr.com/services/api/upload.api.html

A: 

Are you submitting the file via a web application or a desktop app?

mtranda
iPhone application at the moment. But future intentions include other mobile devices, and a desktop application.
bean
You can encode chunks of data as base64 and send them to the server in separate calls (using POST) as parameters of the call. I can't help you with the iPhone code but for reading parameters on the server side all you need is Request[paramName] (for POST) or Request.Params[paramName] (for GET calls).
mtranda
Thanks for the response. I will try it. I was hoping for some native way of accomplishing this though! This method seems like it will be quite long.
bean
+1  A: 

Your question is somewhat confusing. But if you are asking how to receive a file via HTTP in an ASP.NET web app... the answer is the FileUpload control. It doesn't really matter what browser (iPhone) the client is using.

Bryan
Thanks for the response. This is not what I am asking though. I don't think I've worded my question correctly. The iPhone will not be using a browser, they will be using an application made specifically to contact my application via a public API (for example like what flickr has: http://www.flickr.com/services/api/). I have no problems creating most methods in the API, my question is how/can I receive a file over this.
bean