Skip to content

Commit

Permalink
don't move imported files to target path if they are not correct file…
Browse files Browse the repository at this point in the history
… type
  • Loading branch information
glynhudson committed May 10, 2016
1 parent 9a79edf commit 8ad0aca
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions backup/backup_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,25 @@ function backup_controller()
{
$result="Sorry, only .tar.gz files are allowed.";
$uploadOk = 0;
}

if ((move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) && ($uploadOk == 1)) {
if ((move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) && ($uploadOk == 1)) {

$fh = @fopen($import_flag,"w");
if (!$fh) {
$result = "ERROR: Can't write the flag $import_flag.";
} else {
fwrite($fh,"$import_script>$import_logfile");
$result = "Backup flag set";
}
@fclose($fh);

$fh = @fopen($import_flag,"w");
if (!$fh) {
$result = "ERROR: Can't write the flag $import_flag.";
header('Location: '.$path.'backup');
} else {
fwrite($fh,"$import_script>$import_logfile");
$result = "Backup flag set";
$result = "Sorry, there was an error uploading the file";
}
@fclose($fh);

header('Location: '.$path.'backup');
} else {
$result = "Sorry, there was an error uploading the file";
}


}

return array('content'=>$result);
Expand Down

0 comments on commit 8ad0aca

Please sign in to comment.