Skip to content

bodyParser (multipart) suggestion/question #428

Closed
wavded opened this Issue Nov 29, 2011 · 5 comments

3 participants

@wavded
wavded commented Nov 29, 2011

So love the multipart parser, thanks for getting it apart of connect! One thing I noticed, if you have a form with three inputs (say two text fields and a file input), and they are all in an array. The order of the fields in the array will be consistent for the two text fields but the file ones will be jumbled (I'm assuming based on when they finish being parsed), is there a way to maintain the array ordering for files as well as fields?

@tj
Sencha Labs member
tj commented Nov 29, 2011

hmm anything i could reproduce? I suppose it depends on when formidable can write them to disk and consider them "done" etc

@wavded
wavded commented Nov 29, 2011

sure, here is an example html snippet that I'm using to submit the form

<form enctype="multipart/form-data" method="post">
   <input name="names"> : <input type="file" size="10" name="files">
   <input name="names"> : <input type="file" size="10" name="files">
   <input name="names"> : <input type="file" size="10" name="files">
</form>

In this example, names will be an array and appear in the order seen above, however files could be any order.

Marc

@tj
Sencha Labs member
tj commented Nov 29, 2011

I'm sure we could map them to retain ordering but im also curious what the use-case is? does the ordering really matter? but we do wait to next() anyway so we could certainly retain it

@wavded
wavded commented Nov 29, 2011

Sure, in my case I had a photo upload, where you could specify a name and a file (and other details) for each photo, in order to keep them together. So when I saved, I could grab the file, name, etc from the same index and put them together. Right now, since this isn't the case I have to letter the inputs like nameA, fileA, typeA. Which is doable, but this way it'd save me a step. It probably is minor but if there is a use case like this one, it may be worth it (or at least more usable than the current state in my case)

@tj
Sencha Labs member
tj commented Nov 29, 2011

ah gotcha, cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.