Actually, I'll find another uploader, thanks anyway
That code is probably easier to use for the newbies, I removed line 11, I added websiteURL, change that too your Site URL (Don't add a HTTP)PHP Code:<?php
$dir = "/home/vhabbo/public_html/images/uploads"; // This is the directory you wish your images to be uploaded. Change "vhabbo" to your username and remember to CHMOD to 777.
$maxsize = "10000000"; // This is the max file size
$websiteurl = ("vhabbo.com"); // Change this to your website URL, adding a www. is additional.
$types_alowed = array("gif", "png", "bmp", "jpg", "jpeg"); // These are the files alowed to upload
// Only edit below if you have knowledge in php.
if(isset($_FILES["file"])) {
$file = $_FILES["file"]["name"];
$dot = explode( ".", $file);
$tempname = $_FILES["file"]["tmp_name"];
if($_FILES["file"]["size"] > $maxsize || $file == "" || !in_array($dot[1], $types_alowed)) {
echo("<p>The following errors occured:<ul>");
$end = "</ul></p>";
$error = "1";
}
if($file == "") {
echo("<li>Please complete the required field \"File\".</li>");
$error2 = "1";
}
if(!in_array($dot[1], $types_alowed) && $error2 != "1") {
echo("<li>You can only upload image files.</li>");
}
if($_FILES["file"]["size"] > $maxsize) {
echo("<li>The size of your image is too big.</li>");
}
echo("$end");
if($error != "1") {
$name = uniqid("img").$_FILES["file"]["name"]; // This will create a random name for the file
$newname = str_replace( " ", "_", $name); // This will replace any spaces in the file name
move_uploaded_file($tempname, "$dir/$newname");
echo("<img src=\"http://". $websiteurl ."/images/uploads/$newname\" border=\"0\" />
<fieldset>
<legend>Direct Link:</legend>
<input type=\"text\" name=\"direct\" value=\"http://". $websiteurl ."/images/uploads/$newname\" class=\"file\" size=\"100%\"><br>
</fieldset>
<legend>HTML Clode:</legend>
<input type=\"text\" name=\"html\" value=\"<a href="http://". $websiteurl ."/upload" target="_blank"><img src="http://v-habbo.com/images/uploads/$newname" border="0"></a>\" class=\"file\" size=\"100%\"><br>
</fieldset>
");
}
}
else {
?>
<form method="post" enctype="multipart/form-data">
<fieldset>
<legend>Select File:</legend>
<input type="file" name="file" class="file" size="20"><br>
</fieldset>
<br>
<input class="submit" type="submit" value="Upload" name="submit">
</form>
<?
}
?>
Sorry if your thread








Reply With Quote



