|
@@ -19,11 +19,13 @@ if (isset($_GET['json']) && $_GET['json'] == "true"){
|
|
|
if (file_exists($target_file)) {
|
|
|
//echo "Sorry, file already exists.";
|
|
|
$uploadOk = 0;
|
|
|
+ $displayMsg = "Upload Failed: File already exists";
|
|
|
}
|
|
|
// Check file size
|
|
|
if ($_FILES["fileToUpload"]["size"] > 25000000) {
|
|
|
//echo "Sorry, your file is too large.";
|
|
|
$uploadOk = 0;
|
|
|
+ $displayMsg = "Upload Failed: File larger than 25MB";
|
|
|
}
|
|
|
// Allow certain file formats
|
|
|
if($imageFileType == "php") {
|
|
@@ -32,15 +34,15 @@ if($imageFileType == "php") {
|
|
|
// Check if $uploadOk is set to 0 by an error
|
|
|
if ($uploadOk == 0) {
|
|
|
//echo "Sorry, your file was not uploaded.";
|
|
|
-// if everything is ok, try to upload file
|
|
|
- $displayMsg = "Sorry, your file was not uploaded. (Maybe file already exists / Not allowed format / file larger than 25MB)";
|
|
|
+ // if everything is ok, try to upload file
|
|
|
+ //$displayMsg = "Sorry, your file was not uploaded. (Maybe file already exists / Not allowed format / file larger than 25MB)";
|
|
|
} else {
|
|
|
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
|
|
|
//echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
|
|
|
$filename = $_FILES["fileToUpload"]["name"];
|
|
|
- $displayMsg = "Done.";
|
|
|
+ $displayMsg = "Upload Succeed";
|
|
|
} else {
|
|
|
- $displayMsg = "Sorry, there was an error uploading your file.";
|
|
|
+ $displayMsg = "Upload Failed: Internal Server Error";
|
|
|
//echo "Sorry, there was an error uploading your file.";
|
|
|
}
|
|
|
}
|
|
@@ -51,7 +53,7 @@ if ($filename != ""){
|
|
|
$content = "data:file/" . $filename;
|
|
|
$content = bin2hex($content);
|
|
|
$max = 0;
|
|
|
- foreach (new DirectoryIterator('Memo/') as $fileInfo) {
|
|
|
+ foreach (new DirectoryIterator($memodir) as $fileInfo) {
|
|
|
if ($fileInfo->isDot()) continue;
|
|
|
$current = pathinfo($fileInfo->getFilename())['filename'];
|
|
|
if (!is_numeric($current)) continue;
|
|
@@ -60,11 +62,11 @@ if ($filename != ""){
|
|
|
|
|
|
//Check if the number of files exceed the max
|
|
|
if ($max > 1000){
|
|
|
- foreach (new DirectoryIterator('Memo/') as $fileInfo) {
|
|
|
+ foreach (new DirectoryIterator($memodir) as $fileInfo) {
|
|
|
$current = pathinfo($fileInfo->getFilename())['filename'];
|
|
|
if (!is_numeric($current)) continue;
|
|
|
if ((int)$current != 0){
|
|
|
- unlink('Memo/' . $current . ".txt");
|
|
|
+ unlink($memodir . $current . ".txt");
|
|
|
}
|
|
|
}
|
|
|
$max = 0;
|
|
@@ -90,7 +92,7 @@ if ($filename != ""){
|
|
|
}else{
|
|
|
if ($jsonReply == true){
|
|
|
if ($uploadOk == 0){
|
|
|
- echo json_encode("Sorry, your file was not uploaded. (Maybe file already exists / Not allowed format / file larger than 25MB)");
|
|
|
+ echo json_encode("Upload Failed: File already exists / Not allowed format / file larger than 25MB");
|
|
|
}
|
|
|
exit();
|
|
|
}
|
|
@@ -101,7 +103,6 @@ if ($filename != ""){
|
|
|
<head>
|
|
|
<title>Quick Send</title>
|
|
|
<link rel="stylesheet" href="tocas.css">
|
|
|
-<script type="text/javascript" src="urlfix.js"></script>
|
|
|
</head>
|
|
|
<body>
|
|
|
<?php
|
|
@@ -114,10 +115,10 @@ if ($filename != ""){
|
|
|
<span class="large header">Quick Send System</span>
|
|
|
<span class="description">Send data between mobile and laptops.<br> Powered by IMUS Laboratory</span>
|
|
|
<div class="ts bottom attached tabbed menu" style="color:white;">
|
|
|
- <a class="item" href="index.php" style="color:#9d9ca3;">Send</a>
|
|
|
+ <a class="item" href="index.php" style="color:#9d9ca3;">Text</a>
|
|
|
+ <a class="active item" href="file.php">Files</a>
|
|
|
<a class="item" href="rx.php" style="color:#9d9ca3;">Receive</a>
|
|
|
- <a class="item" href="img.php" style="color:#9d9ca3;">Image</a>
|
|
|
- <a class="active item" href="file.php">Files</a>
|
|
|
+ <!-- <a class="item" href="img.php" style="color:#9d9ca3;">Image</a> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -140,8 +141,8 @@ if ($filename != ""){
|
|
|
?></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="twelve wide column">
|
|
|
- <h2 class="ts header"><?php echo $displayMsg;?></h2><br>
|
|
|
+ <div class="center aligned twelve wide column">
|
|
|
+ <p class="ts header"><?php echo $displayMsg;?></p><br>
|
|
|
<a href="file.php" class="ts basic button">Upload Next File</a>
|
|
|
<br>
|
|
|
</div>
|
|
@@ -160,7 +161,7 @@ if ($filename != ""){
|
|
|
</div>
|
|
|
<div align="left" class="ts container">
|
|
|
<br>
|
|
|
-CopyRight IMUS Laboratory 2018, All right reserved.
|
|
|
+CopyRight IMUS Laboratory 2021, All right reserved.
|
|
|
</div>
|
|
|
</div>
|
|
|
|