Re: dont print echo
| From: | Daniel Brown | Date: | Fri, 29 Feb 2008 19:49:56 +0000 |
| Subject: | Re: dont print echo | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-270761@lists.php.net to get a copy of this message | ||
On Thu, Feb 28, 2008 at 11:08 PM, Emiliano Boragina
<emiliano.boragina@gmail.com> 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); } ?>