Submit image as FormData [SCI-2879]

This commit is contained in:
Oleksii Kriuchykhin 2018-11-23 11:11:44 +01:00 committed by Anton Ignatov
parent 7315db73f1
commit af94f79f0d
2 changed files with 6 additions and 4 deletions

View file

@ -135,15 +135,17 @@
$('.tui-image-editor-header').hide(); $('.tui-image-editor-header').hide();
$('.file-save-link').off().click(function(ev) { $('.file-save-link').off().click(function(ev) {
var dataUpload = new FormData();
ev.preventDefault(); ev.preventDefault();
ev.stopPropagation(); ev.stopPropagation();
dataUpload.append('image', imageEditor.toDataURL());
animateSpinner(null, true); animateSpinner(null, true);
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '/files/' + data.id + '/update_image', url: '/files/' + data.id + '/update_image',
data: { data: dataUpload,
image: imageEditor.toDataURL() contentType: false,
}, processData: false,
success: function(res) { success: function(res) {
$('#modal_link' + data.id).parent().html(res.html); $('#modal_link' + data.id).parent().html(res.html);
setupAssetsLoading(); setupAssetsLoading();

View file

@ -1,4 +1,4 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file. # Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password] Rails.application.config.filter_parameters += %i(password image)