Skip to content

Commit

Permalink
Delete origine file
Browse files Browse the repository at this point in the history
  • Loading branch information
wincelau committed Sep 11, 2024
1 parent 73f896d commit b5777e4
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions app.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,22 +429,17 @@ function($f3) {

if ($returnCode === false) {
echo "PDF compression failed.";
unlink($outputFileName);
return;
}

if (filesize($filePath) <= filesize($outputFileName)) {
} elseif (filesize($filePath) <= filesize($outputFileName)) {
$error = "pdfalreadyoptimized";
unlink($outputFileName);
header('location: /compress?err=' . $error);
return;
} else {
header('Content-Type: application/pdf');
header("Content-Disposition: attachment; filename=$outputFileName");
readfile($outputFileName);
}

header('Content-Type: application/pdf');
header("Content-Disposition: attachment; filename=$outputFileName");
readfile($outputFileName);

unlink($outputFileName);
unlink($filePath);
}
);

Expand Down

0 comments on commit b5777e4

Please sign in to comment.