Oops - I forgot to add that this works on both Linux and Windows.

"Aidal" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > 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
>
>



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to