image uploading, with special parameters.....
Posted: Mon Mar 22, 2004 6:25 pm
here's my image upload script...
iup.php
how can i limit the file size to 120kb and also i don't know if i can, but is there a way to limit file demensions....ie. 70px by 70px
just wondering and if there is a way to limit this how might i go about it?
thanks....
iup.php
Code: Select all
<?php
if(!isset($_POST['submit']))
{
Print <<< EOT
<html>
<head>
<title>File uploader</title>
<body>
<form enctype="multipart/form-data" action="uploader.php" method="post">
Choose file upload: <input name="userfile" type="file" /><br />
<input type="submit" value="Upload file" />
</form>
</body>
<html>
EOT;
}
else{
$stripspaces = eregi_replace("_"," ",$_FILES["userfile"]["tmp_name"]);
$ext = substr(strrchr($_FILES['userfile']['name'], '.'), 1);
if ($ext == "gif") {
copy($_FILES["userfile"]["tmp_name"], "/images/av_con/" . $_FILES["userfile"]["name"]);
echo "<p>Image uploaded successfully.</p>";
}
else
{
echo "<p>Please upload GIF image files only!</p>";
}
}
?>just wondering and if there is a way to limit this how might i go about it?
thanks....