I am sure this is a newbie question as I have little javascript and sammy.js experience, but I am submitting a form to a sammy route, my text input and hidden input shows up as this.params, but my file input does not. How do I access input from a
<form action="#/my/route" method="post" enctype="multipart/form-data">
<input type="file" name="file" id="file" \>
<input type="submit" value="Upload Subscriptions" />
</form>
req.open('POST', '/api/file', false);
req.setRequestHeader('content-type', 'multipart/form-data');
req.send(JSON.stringify(sammy.params));
});
but the api does not seem to get the file.
if I use
<input type="submit" value="Upload subscription definitions" onclick="submit_import(submit_subscriptions_import($(this).closest('form')[0]))" />
and then
function submit_subscriptions_import(form) {
form.method = "post";
form.action = "api/file";
form.submit();
}
then the api gets the file, however, it then displays the response which is a json file of information as raw json, I need to capture this response and display it in a table.
was hoping I could submit to a route as I do with other posts with no issues, but I cannot figure out how to manage the file in that case.
Any help would be appreciated
Gregg