Add folder creation

master
Skylar Ittner 6 years ago
parent 7758c1db28
commit 1c6ced8198

@ -262,6 +262,15 @@ switch ($VARS['action']) {
returnToSender("upload_success", "&path=" . $VARS['path']);
break;
case "newfolder":
$foldername = preg_replace("/[^a-z0-9_\-]/", "_", strtolower($VARS['folder']));
$newfolder = FILE_UPLOAD_PATH . $VARS['path'] . '/' . $foldername;
if (mkdir($newfolder, 0755)) {
returnToSender("folder_created", "&path=" . $VARS['path']);
}
returnToSender("folder_not_created", "&path=" . $VARS['path']);
break;
case "filedelete":
$file = FILE_UPLOAD_PATH . $VARS['file'];
if (strpos(realpath($file), FILE_UPLOAD_PATH) !== 0) {

@ -115,5 +115,7 @@ define("STRINGS", [
"file not deleted" => "The file could not be deleted.",
"file deleted" => "File deleted.",
"folder deleted" => "Folder deleted.",
"folder created" => "Folder created.",
"folder not created" => "Folder not created.",
"nothing here" => "There doesn't seem to be anything here..."
]);

@ -81,4 +81,12 @@ define("MESSAGES", [
"string" => "folder deleted",
"type" => "success"
],
"folder_created" => [
"string" => "folder created",
"type" => "success"
],
"folder_not_created" => [
"string" => "folder not created",
"type" => "danger"
],
]);

@ -25,7 +25,7 @@ $fullpath = $base . $folder;
<div class="card">
<div class="card-header d-flex justify-content-between">
<nav aria-label="breadcrumb">
<nav aria-label="breadcrumb" class="my-auto">
<ol class="breadcrumb m-0">
<?php
$pathparts = explode("/", "$folder");
@ -48,16 +48,14 @@ $fullpath = $base . $folder;
</ol>
</nav>
<div class="ml-auto">
<div class="ml-auto my-auto">
<form action="action.php" method="POST" enctype="multipart/form-data">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group input-group-sm">
<input type="text" id="uploadstatus" class="form-control" readonly />
<div class="input-group-append">
<span class="btn btn-primary btn-file">
<i class="fas fa-folder-open"></i> <?php lang("browse"); ?> <input id="fileupload" type="file" name="files[]" multiple required />
</span>
</div>
<input type="text" id="uploadstatus" class="form-control" readonly />
<div class="input-group-append">
<button class="btn btn-success" type="submit"><i class="fas fa-cloud-upload-alt"></i> <?php lang("upload"); ?></button>
</div>
</div>
@ -65,6 +63,17 @@ $fullpath = $base . $folder;
<input type="hidden" name="source" value="files" />
<input type="hidden" name="path" value="<?php echo $folder; ?>" />
</form>
<form action="action.php" method="POST" class="mt-1">
<div class="input-group input-group-sm">
<input type="text" class="form-control" name="folder" required />
<div class="input-group-append">
<button class="btn btn-success" type="submit"><i class="fas fa-folder"></i> <?php lang("new folder"); ?></button>
</div>
</div>
<input type="hidden" name="action" value="newfolder" />
<input type="hidden" name="source" value="files" />
<input type="hidden" name="path" value="<?php echo $folder; ?>" />
</form>
</div>
</div>
<div class="card-body">

Loading…
Cancel
Save