Okay I know you people are/was going wild for image uploaders so I've built a simple one for you. I've put comments in so you can understand what to do etc. Remember to CHMOD your images folder to 0777(777) so the uploader can put your upload into that folder.
Yes, I know that it you can upload other file types which is a massive security risk so I only recommend this for little sites.
Have fun, or whatever.PHP Code:<?php
echo "<center>"; //We center the page.
$sitename = "sitename.com"; //Put your site url here.
switch ($_GET[page]) //We use the switch function to get the page.
{
default: //Self explanatory
echo "<form action='?page=upload' enctype='multipart/form-data' method='POST'>
Upload:
<input type='file' size='7' name='image' id='image'><br>
<input type='submit' name='submit' value='Upload'></form>";
break; //Break upload
case 'upload': //The upload case
$filename = $_FILES["img"]["name"];
$tmp_name = $_FILES["img"]["tmp_name"];
$img = "images/$filename"; //You can edit the images piece to where your images will be displayed
if (move_uploaded_file($tmp_name, "images/".$filename)) { //And here - we also move the file
echo "Image upload complete!<br><img src='$img'><br>
Forum ******?<br>
<input type='text' name='image' size='30' value='[IMG]www.".$sitename.".com/files/upload/".$img."[/IMG]'>"; // We display that their file has been uploaded, show then the url and show them a picture of their upload
} else { //Lol the upload failed
die ("Don't bother uploading ever again.. seriously."); //True comment
}
break; //Break page
}
?>





Reply With Quote

)


