ccrevcypsys Posted June 9, 2008 Share Posted June 9, 2008 Hello i get this error when i try uploading a document Warning: move_uploaded_file(formsUpload) [function.move-uploaded-file]: failed to open stream: Is a directory in /home/content/m/c/s/mcssltd/html/admin/forms_upload.php on line 97 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php3kDNgz' to 'formsUpload' in /home/content/m/c/s/mcssltd/html/admin/forms_upload.php on line 97 Sorry, there was a problem uploading your file. if($_POST['upload']==TRUE){ $rand = rand(10000,99999999); $fileName = $rand."_".str_replace(" ", "_", basename($_FILES['FiletoUpload']['name'])); $fileSize = $_FILES['FiletoUpload']['size']; $fileType = $_FILES['FiletoUpload']['type']; $target = $_SERVER['DOCUMENT_ROOT']."/formsUpload/"; $ok=1; //This is our limit file type condition if ($fileType =="text/php" && $fileType=="text/asp"){ echo "No PHP files<br>"; $ok=0; } //Here we check that $ok was not set to 0 by an error if ($ok==0){ $msgF = "Sorry your file was not uploaded"; }else{ if(move_uploaded_file($_FILES['FiletoUpload']['tmp_name'], $target)){ $fileloc = $fileName; $msgF = "The file ". $fileName . " has been uploaded to ".$target.".<br>File Size: ". $fileSize ."-Bytes<br>File Type: ". $fileType; $query = "INSERT INTO formUpload (doc_name) VALUES (".$fileName.")"; $insert = mysql_query($query)or die(mysql_error()."<br>".$query); }else{ echo "Sorry, there was a problem uploading your file.<br>".$fileName; } } } what am i doing wrong because i have the permissions set at 777... Link to comment https://forums.phpfreaks.com/topic/109455-solved-functionmove-uploaded-file-failed-to-open-stream-is-a-directory-in/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.