I created a method in order to upload an image to my server by using web api. However I need to send additional parameters while sending multipart form data. What I want to do is to create a methods which gets required parameters and uploads to desired place by looking that parameters. The method is as like as below
public void AddPhotoItemData( int UserID, int QuestID, int QuestTemplateItemID, double Latitude, double Longitude)
What I COULD NOT do is to trig this method while sending multipart form data and these parameters at the same time. Is there anyway to upload a file with a method that has parameters?
Regards,
KEMAL
The method in your question uses an RPC style signature which runs against the grain of the uniform interfaces that an HTTP based API provides. Look at this good blog post to see what are the “philosophical” differences between RPC and HTTP based APIs.
The Web API facilitates creating HTTP based APIs. This implies you’ll be sending “representations” to specific URIs using the standard GET/POST/DELETE & other HTTP methods. That’s why multiple “parameters” in a “call” aren’t really supported without wrapper of some sort.