Fix errors in js_upload addon
This commit is contained in:
parent
1860e732ae
commit
81f232d57e
3 changed files with 16 additions and 16 deletions
|
@ -2,12 +2,12 @@
|
|||
|
||||
usleep(100000);
|
||||
|
||||
$fileName;
|
||||
$fileSize;
|
||||
$fileName = '';
|
||||
$fileSize = 0;;
|
||||
|
||||
if (isset($_GET['qqfile'])){
|
||||
$fileName = $_GET['qqfile'];
|
||||
|
||||
|
||||
// xhr request
|
||||
$headers = apache_request_headers();
|
||||
$fileSize = (int)$headers['Content-Length'];
|
||||
|
@ -34,13 +34,13 @@ if ($fileSize > 9 * 1024){
|
|||
die ('{error: "server-error file size is bigger than 9kB"}');
|
||||
}
|
||||
|
||||
if (count($_GET)){
|
||||
if (count($_GET)){
|
||||
array_merge($_GET, array('fileName'=>$fileName));
|
||||
|
||||
|
||||
$response = array_merge($_GET, array('success'=>true, 'fileName'=>$fileName));
|
||||
|
||||
// to pass data through iframe you will need to encode all html tags
|
||||
echo htmlspecialchars(json_encode($response), ENT_NOQUOTES);
|
||||
|
||||
// to pass data through iframe you will need to encode all html tags
|
||||
echo htmlspecialchars(json_encode($response), ENT_NOQUOTES);
|
||||
} else {
|
||||
die ('{error: "server-error query params not passed"}');
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
sleep(4);
|
||||
|
||||
$fileName;
|
||||
$fileName = '';
|
||||
|
||||
if (isset($_GET['qqfile'])){
|
||||
$fileName = $_GET['qqfile'];
|
||||
|
||||
|
||||
// xhr request
|
||||
$headers = apache_request_headers();
|
||||
if ((int)$headers['Content-Length'] == 0){
|
||||
|
@ -14,7 +14,7 @@ if (isset($_GET['qqfile'])){
|
|||
}
|
||||
} elseif (isset($_FILES['qqfile'])){
|
||||
$fileName = basename($_FILES['qqfile']['name']);
|
||||
|
||||
|
||||
// form request
|
||||
if ($_FILES['qqfile']['size'] == 0){
|
||||
die ('{error: "file size is zero"}');
|
||||
|
@ -25,7 +25,7 @@ if (isset($_GET['qqfile'])){
|
|||
|
||||
if (count($_GET)){
|
||||
$_GET['success'] = true;
|
||||
echo json_encode(array_merge($_GET));
|
||||
echo json_encode(array_merge($_GET));
|
||||
} else {
|
||||
die ('{error: "query params not passed"}');
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
usleep(300);
|
||||
|
||||
$fileName;
|
||||
$fileName = '';
|
||||
|
||||
if (isset($_GET['qqfile'])){
|
||||
$fileName = $_GET['qqfile'];
|
||||
|
||||
|
||||
// xhr request
|
||||
$headers = apache_request_headers();
|
||||
if ((int)$headers['Content-Length'] == 0){
|
||||
|
@ -14,7 +14,7 @@ if (isset($_GET['qqfile'])){
|
|||
}
|
||||
} elseif (isset($_FILES['qqfile'])){
|
||||
$fileName = basename($_FILES['qqfile']['name']);
|
||||
|
||||
|
||||
// form request
|
||||
if ($_FILES['qqfile']['size'] == 0){
|
||||
die ('{error: "file size is zero"}');
|
||||
|
@ -25,7 +25,7 @@ if (isset($_GET['qqfile'])){
|
|||
|
||||
if (count($_GET)){
|
||||
//return query params
|
||||
echo json_encode(array_merge($_GET, array('fileName'=>$fileName)));
|
||||
echo json_encode(array_merge($_GET, array('fileName'=>$fileName)));
|
||||
} else {
|
||||
die ('{error: "query params not passed"}');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue