Skip to content Skip to sidebar Skip to footer

Submit Additional Form Data Without Setting FormData

I am following How-to-submit-additional-form-data and have a working fileupload that is submitting the additional form data, ie. the additional textarea input field, description[],

Solution 1:

Rather than have it be an array make it a hash? Say using the filename? That way you don't have to rely on things being in the right order.

<textarea name="description[{%=file.name%}]" placeholder="Enter description" class="form-control" rows="3"></textarea>

And in the controller:

var result = DataTranslator.UploadChunk(
  hpf.InputStream, 
  hpf.FileName, 
  description[hpf.FileName],
  hpf.ContentType, 
  hpf.ContentLength, 
  (int)hpf.InputStream.Length, 
  this.TotalBytes, 
  uploader
);

Post a Comment for "Submit Additional Form Data Without Setting FormData"