2011-09-25 08:56:03 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
usleep(100000);
|
|
|
|
|
2024-11-30 19:30:39 +00:00
|
|
|
$fileName = '';
|
|
|
|
$fileSize = 0;;
|
2011-09-25 08:56:03 +00:00
|
|
|
|
|
|
|
if (isset($_GET['qqfile'])){
|
|
|
|
$fileName = $_GET['qqfile'];
|
2024-11-30 19:30:39 +00:00
|
|
|
|
2011-09-25 08:56:03 +00:00
|
|
|
// xhr request
|
|
|
|
$headers = apache_request_headers();
|
|
|
|
$fileSize = (int)$headers['Content-Length'];
|
|
|
|
} elseif (isset($_FILES['qqfile'])){
|
|
|
|
$fileName = basename($_FILES['qqfile']['name']);
|
|
|
|
$fileSize = $_FILES['qqfile']['size'];
|
|
|
|
} else {
|
|
|
|
die ('{error: "server-error file not passed"}');
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($fileName == '4text.txt'){
|
|
|
|
die ('jsgkdfgu4eyij');
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($fileSize == 0){
|
|
|
|
die ('{error: "server-error file size is zero"}');
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($fileSize < 10){
|
|
|
|
die ('{error: "server-error file size is smaller than 10 bytes"}');
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($fileSize > 9 * 1024){
|
|
|
|
die ('{error: "server-error file size is bigger than 9kB"}');
|
|
|
|
}
|
|
|
|
|
2024-11-30 19:30:39 +00:00
|
|
|
if (count($_GET)){
|
2011-09-25 08:56:03 +00:00
|
|
|
array_merge($_GET, array('fileName'=>$fileName));
|
2024-11-30 19:30:39 +00:00
|
|
|
|
2011-09-25 08:56:03 +00:00
|
|
|
$response = array_merge($_GET, array('success'=>true, 'fileName'=>$fileName));
|
2024-11-30 19:30:39 +00:00
|
|
|
|
|
|
|
// to pass data through iframe you will need to encode all html tags
|
|
|
|
echo htmlspecialchars(json_encode($response), ENT_NOQUOTES);
|
2011-09-25 08:56:03 +00:00
|
|
|
} else {
|
|
|
|
die ('{error: "server-error query params not passed"}');
|
|
|
|
}
|