I have a form with a multiple fileupload on. (You can select multiple files within the same filecontrol
These files I have to upload to an API
If I don't have a multiple, but a single fileupload, I can do
byte[] filedata = FileUploadControl.FileBytes;
String filestring = Convert.ToBase64String(filedata);
If have multiple fileupload, I can use this to iterate over the files:
HttpFileCollection fileCollection = Request.Files;
for (int i = 0; i < fileCollection.Count; i++)
{
HttpPostedFile uploadfile = fileCollection[i];
if (uploadfile.ContentLength > 0)
{
Int32 ContentLength = uploadfile.ContentLength;
String ContentType = uploadfile.ContentType;
string filename = uploadfile.FileName;
}
}
But I don't have uploadfile.FileBytes
How can I get the contents of the file to a string?