Uploading images with PHP is relatively easy. For security reasons, you should always check that the file is an image, and that it doesn't exceed a maximum size.
HTML CODE
<form method="post" action=""
enctype="multipart/form-data">
Attach File<input type="file" name="fnm">
<input type="submit" name="go" value="Go">
</form>
php code
<?php
@$fnm=$_FILES['fnm'];
$anm=$fnm['name'];
$tnm=$fnm['tmp_name'];
$s=$fnm['size'];
//res is a directory where image store
$target="res/".$anm;
if($_REQUEST['go'])
{
move_uploaded_file($tnm,$target);
echo "uploded file";
}
?>
No comments:
Post a Comment