javascript - Get dynamic request params in node.js -


how can construct array says have dynamic dom below?

<input type="hidden" name="file1" value="1.jpg"> <input type="hidden" name="file2" value="2.jpg"> <input type="hidden" name="file3" value="3.jpg"> <input type="hidden" name="file4" value="4.jpg"> .. .. , on 

one way save input calculate length of file, req.body.number_of_file later on can loop through that.

is there alternative it?

if inputs consistently , consecutively numbered, in example, go for:

<input type="hidden" name="files" value="4"> <!-- or 5, 6, 42, etc. --> 

otherwise, try having inputs part of input array:

<input type="hidden" name="files[]" value="1.jpg"> <input type="hidden" name="files[]" value="2.jpg"> <input type="hidden" name="files[]" value="3.jpg"> <input type="hidden" name="files[]" value="4.jpg"> 

node.js doesn't support input arrays; here's question tips that: node.js form elements array


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -