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"; } ?> Link to comment https://forums.phpfreaks.com/topic/191188-form-upload-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.