diff --git a/www/admin/qq_file_upload_ajax.php b/www/admin/qq_file_upload_ajax.php index ef56029b..29d950d4 100755 --- a/www/admin/qq_file_upload_ajax.php +++ b/www/admin/qq_file_upload_ajax.php @@ -16,6 +16,10 @@ $allowedExtensions = array ('csv', 'zip', 'jpg', 'pdf'); $sizeLimit = $MAX_UPLOAD_SIZE; // as set in php ini $base->debug('AJAX UPLOAD', 'Size: '.$sizeLimit.', Memory Limit: '.ini_get('memory_limit')); $uploader = new CoreLibs\Upload\qqFileUploader($allowedExtensions, $sizeLimit); +// either in post or get +$_action= $_POST['action'] ? $_POST['action'] : $_GET['action']; +$_task_uid = $_POST['task_uid'] ? $_POST['task_uid'] : $_GET['task_uid']; +$base->debug('AJAX UPLOAD', 'Action: '.$_action.', Task UID: '.$_task_uid); $upload_path = ROOT.MEDIA.UPLOADS; $get_post['result'] = $uploader->handleUpload($upload_path, false); diff --git a/www/admin/qq_file_upload_front.php b/www/admin/qq_file_upload_front.php index 2eadc4c8..41a06547 100755 --- a/www/admin/qq_file_upload_front.php +++ b/www/admin/qq_file_upload_front.php @@ -68,7 +68,7 @@ $base->debug('UPLOADED FRONT', 'With max size: '.$MAX_UPLOAD_SIZE); var MAX_UPLOAD_SIZE = ; // function to add an AJAX uploadeder to the set function createUploaderSin(divName, divNumber) { - divID = divName + divNumber; + divID = divName + '_' + divNumber; console.log('Div: %s, Number: %s => ID: %s', divName, divNumber, divID); var uploader = new qq.FileUploaderBasic({ @@ -82,29 +82,30 @@ $base->debug('UPLOADED FRONT', 'With max size: '.$MAX_UPLOAD_SIZE); name: divID, params: { 'file_pos': divNumber, // we need to add here ID or something - 'action': 'upload' + 'action': 'upload', + 'task_uid': divNumber // -> test for some internal uid }, onSubmit: function(id, filename, target) { console.log('File upload: "%s", ID: "%s" => "%s"', filename, id, target); // remove any assigned error classes and flags - if ($(target + 'Progress').hasClassName('uploadError')) + if ($(target + '_Progress').hasClassName('uploadError')) { - $(target + 'Progress').className = ''; - $(target + 'Error').value = 0; + $(target + '_Progress').className = ''; + $(target + '_Error').value = 0; } - $(target + 'Progress').innerHTML = 'Start uploading file: ' + filename; + $(target + '_Progress').innerHTML = 'Start uploading file: ' + filename; // disabled stuff here }, onProgress: function(id, filename, loaded, total, target) { console.log('Progress for file: "%s", ID: "%s", loaded: "%s", total: "%s" => "%s"', id, filename, loaded, total, target); var percent = Math.round((loaded / total) * 100); - $(target + 'Progress').innerHTML = 'Uploading: ' + filename + ', ' + percent + '%' + ' (' + formatBytes(loaded) + '/' + formatBytes(total) + ')'; + $(target + '_Progress').innerHTML = 'Uploading: ' + filename + ', ' + percent + '%' + ' (' + formatBytes(loaded) + '/' + formatBytes(total) + ')'; }, onComplete: function(id, filename, responseJSON, target) { console.log('File upload for file "%s", id "%s" done with status "%s" => "%s", And success: %s', filename, id, responseJSON, target, responseJSON.result.success); if (responseJSON.result.success) { - $(target + 'Progress').innerHTML = 'Uploaded: ' + filename + ' (' + responseJSON.filesize_formated + ')'; + $(target + '_Progress').innerHTML = 'Uploaded: ' + filename + ' (' + responseJSON.filesize_formated + ')'; // also write hidden vars for this (file name, etc) // for that we replace the divName part from the target and get just the pos number ? // $(target + 'Name').value = filename; @@ -115,11 +116,11 @@ $base->debug('UPLOADED FRONT', 'With max size: '.$MAX_UPLOAD_SIZE); else { // set the error class - $(target + 'Progress').className = 'uploadError'; + $(target + '_Progress').className = 'uploadError'; // flag error - $(target + 'Error').value = 1; + $(target + '_Error').value = 1; // and write the error - $(target + 'Progress').innerHTML = 'UPLOAD FAILED FOR FILE: ' + filename; + $(target + '_Progress').innerHTML = 'UPLOAD FAILED FOR FILE: ' + filename; } // renable stuff here }, @@ -138,22 +139,22 @@ $base->debug('UPLOADED FRONT', 'With max size: '.$MAX_UPLOAD_SIZE);
File upload via AJAX
-
Upload File
-
- +
Upload File
+
+
-
Upload File
-
- +
Upload File
+
+
printErrorMsg();