Functie si formular de incarcare imagine in PHP
Category: PHP 0
<!-- Form Area -->
<form action="uploader.php" method="post" enctype="multipart/form-data">Select Image: <input type="file" name="userfile" />
<input type="submit" value="Upload!" /></form>
<!--?php # Variables $path = "images/"; $max_size = "200000"; # File $filename = $_POST['userfile']; # Control if (!isset($HTTP_POST_FILES['userfile'])) exit; if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) { if ($HTTP_POST_FILES['userfile']['size']-->$max_size) {
echo "The File is Too Big. The Max File Size is $max_size KB
n";
exit;
}
# Type Control
if (
($HTTP_POST_FILES['userfile']['type']=="image/gif") ||
($HTTP_POST_FILES['userfile']['type']=="image/jpg") ||
($HTTP_POST_FILES['userfile']['type']=="image/bmp") ||
($HTTP_POST_FILES['userfile']['type']=="image/png") ||
($HTTP_POST_FILES['userfile']['type']=="image/jpeg")
)
{
# If File Exist
if (file_exists($path . $HTTP_POST_FILES['userfile']['name']))
{
echo "A File With That Name Already Exists!
";
exit;
}
$res = copy($HTTP_POST_FILES['userfile']['tmp_name'], $path .
$HTTP_POST_FILES['userfile']['name']);
if (!$res){
echo "Upload Failed!
";
exit;
}
else{
echo "Upload Sucessful!
";
}
echo "File Name: ".$HTTP_POST_FILES['userfile']['name']."
";
echo "File Size: ".$HTTP_POST_FILES['userfile']['size']." bytes
";
echo "File Type: ".$HTTP_POST_FILES['userfile']['type']."
";
echo "<a href="$path".$HTTP_POST_FILES['userfile']['name']."">View Image</a>";
}
else
{
echo "Wrong File Type
";
exit;
}
}
?>
No related posts.
No related posts.






Cod HTML: Adauga ca favor...
<a href=":Add This Page To Your Favorites!"...
Descopera ce fel de devic...
NSString *deviceType = [UIDevice currentDevice].model; if([deviceType...
Exporta fiecare tabel myS...
mysql -e 'show databases' | sed -n '2,$p' | xargs -I...
Functie si formular de in...
<!-- Form Area --> <form action="uploader.php"...