I've been googling this for a little while now. I've seen other stack over flow questions but none of them had the appropriate answer for this problem.
So, basically: I'm trying to reconstruct a form using C# to submit data.
My code is this:
var documentContent = new MultipartFormDataContent();
documentContent.Add(new StringContent("someTag"), "tags[]");
documentContent.Add(new StringContent("https://mywebsitehere.example"), "website");
documentContent.Add(new ByteArrayContent(File.ReadAllBytes("myFile.gif")), "animation");
var response = client.PostAsync("https://mywebsitehere.example", documentContent).Result;
var responseContent = response.Content.ReadAsStringAsync().Result;
Print(responseContent);
So for the top one, I'm trying to set data for this:
<div class="form-group">
<label for="tags">Tags</label>
<select class="form-control select2-multiple" id="tags" name="tags[]" multiple="multiple">
The middle one being:
<div class="form-group">
<label for="website">Website</label>
<input type="text" class="form-control" id="website" name="website" placeholder="Optional">
</div>
And lastly:
<div class="form-group">
<label for="animation">Animation (Optional)</label>
<input type="file" name="animation" id="animation">
<p class="help-block">Upload animation</p>
</div>
I'm really not sure how to make this possible, but if someone could direct me in the right direction to submit this data using C# that would be awesome!!