Merge pull request #4663 from christianbeeznest/encora-20644

Work: Add cidReq parameter to bigUpload url - refs BT#20644
pull/4667/head
Nicolas Ducoulombier 3 years ago committed by GitHub
commit 08d4255849
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      main/inc/lib/formvalidator/Element/BigUpload.php
  2. 11
      main/inc/lib/javascript/bigupload/js/bigUpload.js

@ -67,6 +67,8 @@ class BigUpload extends HTML_QuickForm_file
bigUpload.settings.progressBarColorError = "#da4f49";
//Path to the php script for handling the uploads
bigUpload.settings.scriptPath = "'.api_get_path(WEB_LIBRARY_JS_PATH).'bigupload/inc/bigUpload.php";
//cid Req
bigUpload.settings.cidReq = "'.api_get_cidreq().'";
//Set the origin upload
bigUpload.settings.origin = "'.$origin.'";
//The parameters from the upload form

@ -46,7 +46,10 @@ function bigUpload () {
//Max file size allowed
//Default: 2GB
'maxFileSize': 2147483648
'maxFileSize': 2147483648,
//CidReq
'cidReq': ''
};
//Upload specific variables
@ -175,7 +178,7 @@ function bigUpload () {
//this.uploadData.key is then populated with the filename to use for subsequent requests
//When this method sends a valid filename (i.e. key != 0), the server will just append the data being sent to that file.
xhr = new XMLHttpRequest();
xhr.open("POST", parent.settings.scriptPath + '?action=upload' + '&key=' + parent.uploadData.key + '&origin=' + parent.settings.origin + (parent.uploadData.key ? '' : '&name=' + parent.uploadData.file.name), true);
xhr.open("POST", parent.settings.scriptPath + '?' + parent.settings.cidReq + '&action=upload' + '&key=' + parent.uploadData.key + '&origin=' + parent.settings.origin + (parent.uploadData.key ? '' : '&name=' + parent.uploadData.file.name), true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
@ -224,7 +227,7 @@ function bigUpload () {
this.sendFileData = function() {
var data = 'key=' + this.uploadData.key + '&name=' + this.uploadData.file.name + '&type=' + this.uploadData.file.type + '&size=' + this.uploadData.file.size + '&origin=' + parent.settings.origin + '&' + parent.settings.formParams;
xhr = new XMLHttpRequest();
xhr.open("POST", parent.settings.scriptPath + '?action=finish', true);
xhr.open("POST", parent.settings.scriptPath + '?' + parent.settings.cidReq + '&action=finish', true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
@ -262,7 +265,7 @@ function bigUpload () {
this.uploadData.aborted = true;
var data = 'key=' + this.uploadData.key;
xhr = new XMLHttpRequest();
xhr.open("POST", this.settings.scriptPath + '?action=abort', true);
xhr.open("POST", this.settings.scriptPath + '?' + this.settings.cidReq + '&action=abort', true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {

Loading…
Cancel
Save