You are here: Re: File deleter « All PHP « IT news, forums, messages
Re: File deleter

Posted by Arjen on 02/04/07 20:28

Andy schreef:
> I have many pictures in the folder. Some of them I want to delete. Because
> my FTP server shows only 1000 pictures, I am using following script.
> Unfortunately it deletes single files only and it takes a time to reload
> after deleting.
> What I want is your help to modify this script so I would make check marks
> at the file and than press a button to delete selected files.
> I am sure there are people who would do it without a problem.
> Your help will be appreciated.

Presuming the files have no strange characters. Otherwise use
urlencode($file) iirc. I didn't test this btw so be carefull (use echo
"unlink ('/path/to/file/'$file)"; first

if (isset($_POST))
{
foreach ($_POST['file'] as $myfile)
{
unlink('/path/to/file'.$file);
}
}

echo '<form>'; // etc
$handle=opendir($path);
while (false!==($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo '<input type="checkbox" name="file[]"
value="'.$file.'"/>'.$file.'<br/>
}
}
closedir($handle);
echo '<input type = "submit">';//etc

--
Arjen
http://www.hondenpage.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация