2014-03-18 19:16:27 +08:00
|
|
|
!function(){
|
|
|
|
'use strict'
|
|
|
|
|
|
|
|
var File = Backbone.Model.extend({
|
|
|
|
url: 'upload-test.php',
|
|
|
|
fileAttribute: 'fileAttachment'
|
|
|
|
});
|
|
|
|
|
|
|
|
var file = new File({
|
|
|
|
from: 'sample@email.com',
|
|
|
|
subject: 'Hello, friend!',
|
2014-03-19 00:17:02 +08:00
|
|
|
body: 'Dear friend, Just saying hello! Love, Yours truly.',
|
|
|
|
nestedObject: {
|
|
|
|
nest: 'eggs'
|
|
|
|
}
|
2014-03-18 19:16:27 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
$('#fileupload').on('change', function(e){
|
|
|
|
var fileObj = $(this)[0].files[0];
|
2014-03-19 00:17:02 +08:00
|
|
|
console.log(fileObj)
|
2014-03-18 19:16:27 +08:00
|
|
|
file.set('fileAttachment', fileObj);
|
|
|
|
file.save();
|
|
|
|
})
|
|
|
|
|
|
|
|
//file.save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}();
|