Title: sails:Can't able to get textbox value while submitting a form with enctype="multipart/form-data"
Tags: javascript;jquery;forms;sails.js
Question: I'm doing file upload in sails.js facing issue while submitting a form with  enctype="multipart/form-data".
my file.ejs
<form id="uploadForm" enctype="multipart/form-data" action="/Employee/upload"
method="post"&gt;
<input type="file" name="uploadFile" /&gt;
<input type="text" name="Name" /&gt;
<input type="submit" value="submit"/&gt;
</form&gt;
my controller
upload: function  (req, res) {
var UserName =req.param("Name");
console.log(UserName);
var uploadFile = req.file('uploadFile');
console.log(uploadFile);
uploadFile.upload(function onUploadComplete (err, files) {
if (err) return res.serverError(err);
console.log(files);
res.json({status:200,file:files});
});
I'm going to do create function in this same upload function for storing file name and UserName into DatabaseTable.but req.param("Name") always shows undefined.How can i get texbox value from this form.
I'm new to this sails.js.So please give any suggestions or sollutions for this bug.It will be very usefull for me.
Comment: @AlexisN-o Maybe it's still not working if we have more than 1 file field

Comment: Maybe [this question](http://stackoverflow.com/questions/29764633/sails-js-form-post-not-submitting-any-data) could help you

Comment: Try to put the input *file* after the input *text*

Comment: You could listen for the *submit* event and reorder the data before sending it to the server. The documentation also [propose to use AJAX for it](https://github.com/balderdashy/skipper#user-content-text-parameters) ...

Comment: thanks @Alexis N-o.it's working fine but i need to put input tex after file only.Is there any way to do please let me know.

Comment: thanks Alexis N-o it works fine.



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 0, 'CommentCount': 6, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:08/19/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<javascript><jquery><forms><sails.js>', 'Title': 'sails:Can\'t able to get textbox value while submitting a form with enctype="multipart/form-data"', 'ViewCount': 385, 'id': 32095746, 'user_AboutMe': '', 'user_AccountId': 6569002.0, 'user_DisplayName': 'Martin', 'user_Reputation': 237.0, 'user_Views': 30.0, 'user_id': 5077686.0}}