lordphate Posted July 8, 2006 Share Posted July 8, 2006 Warning: move_uploaded_file(./storage/upload/e40f5ba010bdb23143e5ea85d9e61611.html): failed to open stream: Permission denied in /home/*/public_html/upload.php on line 44Warning: move_uploaded_file(): Unable to move '/tmp/php2ITsmd' to './storage/upload/e40f5ba010bdb23143e5ea85d9e61611.html' in /home/*/public_html/upload.php on line 44Error uploading file[code]<?$uploadDir = './storage/upload/';if(isset($_POST['upload'])){ $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $category = $_POST['category']; $ext = substr(strrchr($fileName, "."), 1); $randName = md5(rand() * time()); $filePath = $uploadDir . $randName . '.' . $ext; $result = move_uploaded_file($tmpName, $filePath); <----- LINE 44 if (!$result) { echo "Error uploading file"; include 'footer.php'; exit; } if (!$category) { echo "You must Select a category!"; include 'footer.php'; exit; } if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); $filePath = addslashes($filePath); $category = addslashes($category); } $query = "INSERT INTO upload (name, size, type, path, uploader, category) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$filePath', '$member','$category')"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); echo "<br>File uploaded<br>"; }?><form action="" method="post" enctype="multipart/form-data" name="uploadform"> <table width="350" border="0" cellpadding="1" cellspacing="1" class="box"> <tr> <td width="246"><input type="hidden" name="MAX_FILE_SIZE" value="4000000000"><input name="userfile" type="file" class="box" id="userfile"> </td> <td width="350" border="0" cellpadding="1" cellspacing="1"> <select name="category" size="5"><option value="Movie">Movie</option><option value="Hacks">Hacking</option><option value="Audio">Music</option><option value="Applications">Applications</option><option value="Windows">\/\/ ! /\/ |) () \/\/ S</option><option value="Papers">White Papers</option><option value="AllinOnes">All in Ones</option></select></td> <td width="80"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td> </tr> </table></form></body></html></div> <? include 'footer.php'; ?>[/code] Any ideas what is wrong? I can't figure it out ??? Quote Link to comment https://forums.phpfreaks.com/topic/13995-move_uploaded_files-problem/ Share on other sites More sharing options...
Kurt Posted July 8, 2006 Share Posted July 8, 2006 You need to set the permissions of the folder you wish to upload to to 777. Quote Link to comment https://forums.phpfreaks.com/topic/13995-move_uploaded_files-problem/#findComment-54648 Share on other sites More sharing options...
lordphate Posted July 8, 2006 Author Share Posted July 8, 2006 I did...that's the wierd thing.. Quote Link to comment https://forums.phpfreaks.com/topic/13995-move_uploaded_files-problem/#findComment-54649 Share on other sites More sharing options...
Kurt Posted July 8, 2006 Share Posted July 8, 2006 [quote author=lordphate link=topic=99838.msg393402#msg393402 date=1152324868]I did...that's the wierd thing..[/quote]Well, you're getting a "permission denied" which means it isn't writeable. Check to make sure it is writable by debugging it using the is_writable() function. Quote Link to comment https://forums.phpfreaks.com/topic/13995-move_uploaded_files-problem/#findComment-54651 Share on other sites More sharing options...
lordphate Posted July 8, 2006 Author Share Posted July 8, 2006 Oh..i lied heh...i had it 766 Thanks :D Quote Link to comment https://forums.phpfreaks.com/topic/13995-move_uploaded_files-problem/#findComment-54652 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.