Start
This commit is contained in:
18
app/Http/Controllers/form_bundle_libraries/delete_file.php
Normal file
18
app/Http/Controllers/form_bundle_libraries/delete_file.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
if (! (! empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')) {
|
||||
echo 'Permission denied';
|
||||
exit;
|
||||
}
|
||||
if (! empty($_POST['file_name'])) {
|
||||
$toDelete = './uploads/'.$_POST['file_name'];
|
||||
if (unlink($toDelete)) {
|
||||
echo json_encode(['success' => 1,
|
||||
'msg' => 'Removed', ]);
|
||||
exit;
|
||||
} else {
|
||||
echo json_encode(['success' => 0,
|
||||
'msg' => 'Try again', ]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user