trying to addFile in plupload using input field of type file -
i've used plupload browse button option successfully, trying use utility resize files within existing web page user individually selects files. understood documentation uploader addfile method work input fields i'm having no success.
the field defined as:
<input id="selectuserfile1" name="userfile1" type="file" accept="image/gif,image/jpeg" aria-labelledby="selectuserfile1-arialabel" title="browse file on computer" />
and add file with:
uploader.init(); uploader.addfile(document.getelementbyid('selectuserfile1')); alert('files total: ' + uploader.files.length); uploader.start();
it seems fail though, filesadded method not called , uploader.files.length 0. uploader defined follows:
var filecount = 1; var uploader = new plupload.uploader({ runtimes : 'html5,flash,silverlight,html4', url : 'test_file_upload.php', flash_swf_url : '../testjs/moxie.swf', silverlight_xap_url : '../testjs/moxie.xap', resize: { width: 500, height: 500 }, filters : { max_file_size : '5mb', mime_types: [ {title : "image files", extensions : "jpg,gif"} ] }, // preinit events, bound before internal events preinit: { uploadfile: function(up, file) { //log('[uploadfile]', file); // can override settings before file uploaded up.settings.url = 'test_file_upload.php?cnt=' + filecount; filecount = filecount + 1; } }, init: { filesadded: function(up, files) { alert('files added: ' + up.files.length); }, error: function(up, err) { alert( err.message + ' file not included.' ); } } });
what doing wrong?
Comments
Post a Comment