|
|
Delete an uploaded file using php - unlink() - PHP
|
Views : 1171
|
|
Tagged in : PHP
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
Delete an uploaded file using php - unlink()
The following link will help you to unzip/extract a file using php.
Unzip/Extract an uploaded file using php
and here the following code will help you to delete the uploaded file.
After unzip the file just use unlink() function after $zip->close(); to delete the file,
unlink($zip_file_name.zip);
Example:
<?php
$zip = new ZipArchive;
$res = $zip->open('zip_file_name.zip');
if ($res === TRUE) {
$zip->extractTo('dir_name/'); //will extract the file
$zip->close();
unlink(zip_file_name.zip); //will delete the file
echo 'Extracted';
} else {
echo 'Failed to Extract';
}
?>
|
|
By - Sanju, On - 2010-06-24 |
|
|
|