Add additional AddField in FormData
guizmo01 opened this issue · 2 comments
guizmo01 commented
public FormData AddField(string name, byte[] rawData, string fileName, string contentType)
{
formData.Add(new MultipartFormFileSection(name, rawData, fileName, contentType));
return this;
}
needed this for properly uploading a file to my server without it i was getting error 500
eg:
string[] files = Directory.GetFiles(@"Assets\Resources\Files");
foreach(var f in files)
{
Debug.Log(f);
}
Byte[] aFile = File.ReadAllBytes(files[2]);
string val = Encoding.UTF8.GetString(aFile);
FormData formData = new FormData()
.AddField("Title", "TestUpload2")
.AddField("Bytes", aFile, "Test.jpg", "image/jpg");
satanas commented
Got it! Thanks for reporting it. I think I'll be doing some of these changes during the weekend to release a new version as soon as possible.