tj7723 Posted February 6, 2010 Share Posted February 6, 2010 Right now i am stuck. I am trying to make an upload form so i can upload files to my server. I am some what new to all of this so please take it easy one me <?php $goodExtensions = array('.doc','.docx','.txt','.pdf','.xls','.xlsx','.avi'); $error=''; $uploaddir = '/upload/'; $name = $_FILES['filename']['name']; $minFileSize=10; $extension = substr($name, strpos($name,'.'), strlen($name)-1); // no matter what i upload i get "extension not allowed" if(!in_array($extension,$goodExtensions)); { $error.="Extension not allowed<br />"; } if(filesize($_FILES['filename']['tmp_name']) <= $min_filessize) { $error.="File size too small<br />"; } $uploadfile = $uploaddir . $stem.$extension; $filename=$stem.$extension; if($error == '') { if(move_uploaded_file($_FILES['filename']['tmp_name'], $uploadfile)) { echo 'File UPloaded. Thank you.'; } } else{ echo "$error"; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.