javascript - Store file content in a table(html table tr td) jquery -


i wanted insert multiple files in database uploading/adding each file content table after adding files table add tables' value including file content in form data pass ajax. tried

var file = $('#file')[0].files[0]; //var file = document.getelementbyid('file').files[0]; var name = file.name; var size = file.size; var type = file.type; var blob = new blob([file], {     type: "application/octet-binary" }); var filecontent = blob; 

here used value of filecontent passed ajax in php condition if(!empty($_files) remaind false)

and on console.log filecontent looks [object blob] want achieve primary goal store database asked question it. can found here problem why asked first one.

my question how store file content variable in case store value of $('#file')[0].files[0] file.

update

when used value of var file = $('#file')[0].files[0]; still same error

update

is possible store input:file table td or input or any other element , reuse file if needed

to store content of file variable first need read them , have use filereader.

for example readastext() method syntax:

instanceoffilereader.readastext(blob[, encoding]); 

the readastext method used read contents of specified blob or file. when read operation complete, readystate changed done, loadend triggered, , result attribute contains contents of file text string.

hence can store result variable.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -