<?php
$uploaddir="uploads";
$allowed_ext="jpg,JPG,png,gif,zip,rar,txt,exe,app,mp3,mp4,avi,wmv,dll";
$max_size="21474836480";
$max_height="2000";
$max_width="2000";
$this_variable="http://www.aquaticgaming.com";
//Check extension
$extension=pathinfo($_FILES['file']['name']);
$extension=$extension[extension];
$allowed_paths=explode(",",$allowed_ext);
for($i=0; $i < count($allowed_paths); $i++){
if ($allowed_paths[$i]=="$extension"){
$ok="1";
}
}
//Check File Size
if ($ok =="1"){
if($_FILES['file']['size']>$max_size)
{
print"Yor file is too big!";
exit;
}
//Check Length & Width
if ($max_width && $max_height) {
list($width, $hieght, $type, $w)=
getimagesize($_FILES['file']['tmp_name']);
if($width > $max_height || $height > $max_height)
{
print"File height/width is too big!";
exit;
}
}
//Upload part
if(is_uploaded_file($_FILES['file']['tmp_name']))
{
move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.'/'.$_FILES['file']['name']);
}
//print"Your file uploaded successfully! Cookie?";
print"<font color=\"#00FF00\">Successful upload!</font><br><br> Your file is pretty excited over here ----> <a href='".$this_variable."/".$uploaddir."/".$_FILES['file']['name']."'> CLICK MEH!</a>";
}else{
print"Wrong file extension.....sexy...";
}
?>
That is my upload.php code
I have a website where i want people to upload their files and have those files be available on a pretty sub-page on my website. Here is my website for refrence: www.aquaticgaming.com
And right now the only way to access the uploaded files is to go to www.aquaticgaming.com/uploads which is sort of what i would like as far as a list of files goes, but the problem is: That /uploads url is just a autogenerated html page because what im directing the browser to is a folder. I'm not shure if this made much sense, but i would really appreciate help if you understand what I'm trying to do 🙂