2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-14 15:41:10 +00:00
Oliver Walters
2019-05-06 21:49:01 +10:00
parent eec0fc34d2
commit c88149b9aa
3 changed files with 71 additions and 1 deletions

View File

@@ -110,7 +110,47 @@
console.log('dropped');
//$(this).removeClass('dragover');
if (files.length > 0) {
var file = files[0];
var formData = new FormData();
var token = getCookie('csrftoken');
formData.append('file', file);
$.ajax({
beforeSend: function(xhr, settings) {
xhr.setRequestHeader('X-CSRFToken', token);
},
url: "{% url 'part-image-upload' part.id %}",
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(data, status, xhr) {
//location.reload();
},
error: function(xhr, status, error) {
console.log('Error uploading thumbnail: ' + status);
console.log(error);
}
});
/*
inventreeUpdate(
"{% url 'part-image-upload' part.id %}",
formData,
{
method: 'POST',
dataType: 'json',
}
);
*/
console.log('submitted');
}
});
$("#show-qr-code").click(function() {