var uploader; var param; $(function() { $('#file_upload').uploadify({ 'swf' : '/js/lib/uploadify/uploadify.swf', 'uploader' : '/service/uploadapplicationform', 'multi' : false, 'auto' : true, 'fileTypeExts' : '*.pdf', 'fileSizeLimit' : '20MB', 'onUploadSuccess' : function(file, data, response) { upload.onsuccess(file, data, response); }, 'onUploadStart' : function(file) { $('#file_upload').uploadify('settings','formData',param); } }); }); var upload = { onsuccess : function(file, data, response){ _data = $.parseJSON(data); if(!$.isEmptyObject(_data.error)) { alert(_data.error); }else{ $('#upload-form').modal('hide'); window.location = window.location; } }, showUploadForm : function(id){ $('#upload-form').modal('show'); param = { "PHPSESSID" : _this.SessionID, 'offlineappid' : id }; } };