Skip to content

Commit

Permalink
Fix formatting in uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
fenimore committed Dec 13, 2016
1 parent 780abb6 commit 0ce2729
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions rest/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// errors
$error = "";

if ( !empty($_POST) ) {
if ( !empty($_POST) ) {
// NULLE!
extract($_POST); //What even does this doo...
$category = $_POST['category'];
Expand All @@ -11,25 +11,25 @@
$extension=array("jpeg","jpg","png","gif");

if( is_dir($path)) {
foreach($_FILES["files"]["name"] as $key=>$tmp_name){
$file_name=$_FILES["files"]["name"][$key];
$file_tmp=$_FILES["files"]["tmp_name"][$key];
$ext=pathinfo($file_name,PATHINFO_EXTENSION);
if(in_array($ext,$extension)){
if(!file_exists($path."/".$file_name)){
move_uploaded_file($file_tmp=$_FILES["files"]["tmp_name"][$key], $path."/".$file_name);
} else {
$error = "duplicates, change file name";
}
} else {
$error = "extensions are no good";
foreach($_FILES["files"]["name"] as $key=>$tmp_name){
$file_name=$_FILES["files"]["name"][$key];
$file_tmp=$_FILES["files"]["tmp_name"][$key];
$ext=pathinfo($file_name,PATHINFO_EXTENSION);
if(in_array($ext,$extension)){
if(!file_exists($path."/".$file_name)){
move_uploaded_file($file_tmp=$_FILES["files"]["tmp_name"][$key], $path."/".$file_name);
} else {
$error = "duplicates, change file name";
}
} else {
$error = "extensions are no good";
}
}
}
header("Location: ../gallery.php?category=" . $category ."&gallery=" . $dirname);
header("Location: ../gallery.php?category=" . $category ."&gallery=" . $dirname);
} else {
$error = "this is not a directory";
$error = "this is not a directory";
}
}
}

?>
<!DOCTYPE html>
Expand Down

0 comments on commit 0ce2729

Please sign in to comment.