-
email入力欄を作成、入力した項目はサーバに送信
.container
h1 #{title}
p this is #{title}
p Upload your fasta file below
form(action="./upload" method="POST" enctype="multipart/form-data")
input(type="file" name="file" id="inputfile")
input(type="text" id="email")
button(type="button" onclick="file_upload()" value="Upload")
script.
var slice_size = 100 * 1024 * 1024;
var files;
var file;
var slice_file;
var reader = new FileReader();
var content;
var sendData = {};
function file_upload() {
var slice_file = $("#inputfile")[0].files[0].slice(0,slice_size);
reader.readAsText(slice_file);
reader.onload = function() {
content = reader.result;
console.log(content);
sendData.fileContent = content;
sendData.email = $("#email")[0].value;
$.ajax({
type: "POST",
url: "./upload/",
data: sendData,
dataType: "json",
})
.done(function(res){
console.log("success");
})
.fail(function(res){
console.log("falied");
});
}
}