Sha256: 77a76d7fcc390ca2e9a03b5408244481e808fda4c9a314e90ed4f22860f82fd1
Contents?: true
Size: 1.97 KB
Versions: 21
Compression:
Stored size: 1.97 KB
Contents
<script type="text/javascript"> function attachFileUploader() { <% key = Rails.application.config.session_options[:key] %> var uploadify_script_data = {}; var csrf_param = $('meta[name=csrf-param]').attr('content'); var csrf_token = $('meta[name=csrf-token]').attr('content'); uploadify_script_data[csrf_param] = encodeURI(encodeURIComponent(csrf_token)); uploadify_script_data['<%= key %>'] = '<%= cookies[key] %>'; //var uploadify_script_data = {}; $('#file_uploader').uploadify({ swf: '<%= asset_path("uploadify.swf") %>', uploader: '<%= url_for(controller: '/admin/store/printable_catalogs', action: 'create') %>', buttonText: 'Загрузить файлы...', buttonCursor: 'hand', height: 20, fileExt: '*.pdf;', fileDesc: 'Возможна загрузка только PDF файлов', auto: true, multi: true, removeCompleted: false, beforeSend: function (xhr) { //alert("Before Send"); xhr.setRequestHeader('X-CSRF-Token', csrf_token); }, onUploadSuccess: function (file, data, response) { var upFileData = jQuery.parseJSON(data); //alert('Image Data:' + imageData.filename.thumb.url ); var str = '<li>' + '<a href="' + upFileData.filename.url + '" alt=""/>file </a>' + '</li>'; $('#uploaded_files_container').append(str); }, onUploadError: function (file, errorCode, errorMsg, errorString) { alert('The file ' + file.name + ' could not be uploaded: ' + errorString); }, formData: uploadify_script_data, onUploadComplete : function(file) { //alert(jQuery.toJSON(file)); } }); } </script>
Version data entries
21 entries across 21 versions & 1 rubygems