<?php
$uploaddir="uploads/images";
$allowed_ext="jpg,png,gif,zip,rar,txt,exe,app,mp3,mp4,avi,wmv";
$max_size="21474836480";
$max_height="2000";
$max_width="2000";
//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?";
}else{
print"Wrong file extension, BRO.";
}
?>
Thats my upload file.
I need it to give a link to the file that was uploaded, instead of displaying: "Your file uploaded successfully! Cookie?"
Here is a website(test website) that i made with it, so you can see how to code works: www.aquaticgaming.com
Thanks 🙂