file upload - Knockout pass filename to server -


i'm writing application using knockout. want user browse file , want pass filename server. however, due browser security issues, path of file c:\fakepath.

does 1 way filename server can file , upload it? reason want use server upload file because i'm storing file using amazon s3 , want server connection.

here's binding:

<input type="file" name="talkfile" data-bind="value: $root.talkfile"> 

knockout doesn't have file binding. either submit file old fashioned way or jquery file upload ajax files.

if opt. use ajax in template, make sure form wrapping file element multipart encoding (enctype="multipart/form-data") , can add custom binding.

i use this: template

<input type="file" id="fileupload" name="image" data-bind="fileupload : '.dropzone' " > 

custom binding

 ko.bindinghandlers.fileupload = {     init: function(el, valueaccessor, aba, mod){         $(el).fileupload({             dropzone: valueaccessor(), //this .dropzone             url: '/upload/path,             datatype: 'json',             done: function (e, data) {                               }         });     } }; 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -