Re: how to delete file in windows
| From: | Aidal | Date: | Wed, 06 Aug 2003 10:17:04 +0000 |
| Subject: | Re: how to delete file in windows | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-21036@lists.php.net to get a copy of this message | ||
Oops - I forgot to add that this works on both Linux and Windows.
"Aidal" <aidal@nospam.dk> wrote in message
news:20030806101625.36563.qmail@pb1.pair.com...
> Check this out for a moment - this script takes a file name from a form
> field (on the prior page) of the type file, which is used in HTML when you
> want to be able to open a file browser from your page - hence the
> $HTTP_POST_FILES as argument.
>
> if (!is_uploaded_file($HTTP_POST_FILES['file']['tmp_name'])) {
> echo "Error - file not uploaded";
> @unlink($HTTP_POST_FILES['file']['tmp_name']);
> } else {
> if ($HTTP_POST_FILES['file']['size'] > $max_size_allowed) {
> echo "Error - File was larger than the allowed maximum size";
> @unlink($HTTP_POST_FILES['file']['tmp_name']);
> } else {
> if ($HTTP_POST_FILES['file']['type'] != "image/gif"
> AND
> $HTTP_POST_FILES['file']['type'] != "image/pjpeg") {
> echo "Error - only file types .gif and .jpg are allowed";
> @unlink($HTTP_POST_FILES['file']['tmp_name']);
> } else {
>
>
copy($HTTP_POST_FILES['file']['tmp_name'],"../some_dir_name/".$HTTP_POST_FIL
> ES['file']['name']);
> @unlink($HTTP_POST_FILES['file']['tmp_name']);
>
@chmod("../some_dir_name/".$HTTP_POST_FILES['file']['name'],
> 0777);
> echo "The file " .
> $HTTP_POST_FILES['file']['name'] . "
was
> uploaded";
> }
> }
> }
>
> /Aidal
>
> "Guest" <bakpia_lumpia@yahoo.com> wrote in message
> news:20030805222313.27791.qmail@web40501.mail.yahoo.com...
> > Hii...
> > How to delete file under windows with php, i found function unlink, but
> this function run under linux, is there true that there are no function to
> delete file in windows with php...??
> >
> > Is there any idea..???
> >
> > thanx
> >
> >
> > ---------------------------------
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site design software
>
>