Re: dont print echo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 28, 2008 at 11:08 PM, Emiliano Boragina
<emiliano.boragina@xxxxxxxxx> wrote:
>  When I try the php the echo "no picture =("; is there. How can I do to don't
>  appears the message before I upload de picture.

    Here's your code, re-written.

<?
if(isset($_FILES)) {
    // The following regexp handles file extension checking.  Modify
it as needed.
    if(preg_match('/(.*)(bmp|gif|jpeg|jpg|png)$/i',substr(basename(__FILE__),-3,3)))
{
        $folder = 'pictures';
        if(copy($_FILES['file']['tmp_name'] , $folder . '/' .
$_FILES['file']['name']))
            echo "Picture upload!";
        } else {
            echo "no picture =(";
        }
    } else {
        // Handle your "incorrect file type" errors here.
        die("Incorrect file type.");
    }
}
?>
<form action="<?=$_SERVER['PHP_SELF'];?>" method="post"
enctype="multipart/form-data">
<!--
    These fields are hidden.  You can only have one submit button per form,
    and we're only dealing with the image uploads with this question.

   <input type="text" name="folder">
   <input type="submit" value="ADD FOLDER">
   <hr>
-->
   <input type="file" name="file">
   <input type="submit" value="UPLOAD">
</form>

-- 
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux