phpretard Posted March 21, 2008 Share Posted March 21, 2008 When I use this to make a directory it makes a directory, but... When I try to open that directory I am promted that The Folder refers to a nonexistant file or folder Or it isn't valid or in the current web. Is there something wrong with this code? mkdir("/html/pages/folder1 ", 0700); Link to comment https://forums.phpfreaks.com/topic/97269-make-directory/ Share on other sites More sharing options...
MadTechie Posted March 21, 2008 Share Posted March 21, 2008 could be the space at the end of isn't a valid path from the root maybe try this <?php mkdir(dirname(__FILE__)."/html/pages/folder1", 0700); ?> Link to comment https://forums.phpfreaks.com/topic/97269-make-directory/#findComment-497723 Share on other sites More sharing options...
BlueSkyIS Posted March 21, 2008 Share Posted March 21, 2008 those permissions are probably invalid for the current user, the script making the directory. MadTechie also has a good point. Link to comment https://forums.phpfreaks.com/topic/97269-make-directory/#findComment-497725 Share on other sites More sharing options...
phpretard Posted March 21, 2008 Author Share Posted March 21, 2008 I am actually trying to take the last advise from BlueSkyIS. I want to upload a pfd to a directory instead of storing it in the DB. I would like to be able to create a new directory for that pdf during upload. Any thoughts on that? Here is the full code MadTechie... It does visualy make the folder I just can't access it. mkdir("/home/content/d/a/r/daruano/html/pages/folder1 ", 0700); What should the permissions be. I am logged in as administrator with full rights. Link to comment https://forums.phpfreaks.com/topic/97269-make-directory/#findComment-497738 Share on other sites More sharing options...
MadTechie Posted March 21, 2008 Share Posted March 21, 2008 i think you want "0744" for the access if you want everyone to read it! "0755" for read and execute Link to comment https://forums.phpfreaks.com/topic/97269-make-directory/#findComment-497745 Share on other sites More sharing options...
phpretard Posted March 21, 2008 Author Share Posted March 21, 2008 It still gives an error about not in the web... How would you go about acomplishing what I am tryin to acomplish. I want to upload a pfd to a directory instead of storing it in the DB. I would like to be able to create a new directory for that pdf during upload. Link to comment https://forums.phpfreaks.com/topic/97269-make-directory/#findComment-497754 Share on other sites More sharing options...
BlueSkyIS Posted March 21, 2008 Share Posted March 21, 2008 yes, as i understand, permissions 0700 says "only root can read, write or execute". Since the web server doesn't (or shouldn't) run as root, that's like trying to create a directory that even you can't read. you may need to go to 0775 or 0777 to allow the web server to write to the directory. Link to comment https://forums.phpfreaks.com/topic/97269-make-directory/#findComment-497756 Share on other sites More sharing options...
phpretard Posted March 21, 2008 Author Share Posted March 21, 2008 Each one these numbers still produce the same error. Currently, the page with this code (and this code only) is located @ www.mywebsite.com/thiscode.php Is it relavant where (in the web directory) the code is executed from? I believe I am just missing something simple. mkdir("/home/content/d/a/r/daruano/html/pages/folder1 ", 0777); Link to comment https://forums.phpfreaks.com/topic/97269-make-directory/#findComment-497766 Share on other sites More sharing options...
BlueSkyIS Posted March 21, 2008 Share Posted March 21, 2008 hm, probably shouldn't have that space at the end of the directory name string mkdir("/home/content/d/a/r/daruano/html/pages/folder1", 0777); Link to comment https://forums.phpfreaks.com/topic/97269-make-directory/#findComment-497767 Share on other sites More sharing options...
phpretard Posted March 21, 2008 Author Share Posted March 21, 2008 I took the space away and...same error. This doesn't make any sense... I can rename the folder and when I rename it I can then open it??? Link to comment https://forums.phpfreaks.com/topic/97269-make-directory/#findComment-497772 Share on other sites More sharing options...
phpretard Posted March 21, 2008 Author Share Posted March 21, 2008 Is there a code piece that can make a directry and then insert a blank file into that same directory? Link to comment https://forums.phpfreaks.com/topic/97269-make-directory/#findComment-497779 Share on other sites More sharing options...
phpretard Posted March 21, 2008 Author Share Posted March 21, 2008 So here is what I did. When the page opens it makes the directory. When I submit the form it trys to make another directory and insert the pdf. Notice the 2 errors fighting? <?php mkdir("/home/content/d/a/r/daruano/html/pages/test ",0777); if (isset($_POST['submit'])){ $uploaddir = "../../pages/test"; if(is_uploaded_file($_FILES['file']['tmp_name'])) { move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.'/'.$_FILES['file']['name']); } print "done"; } ?> <form action="test_form.php" method="post" ENCTYPE="multipart/form-data"> File: <input type="file" name="file" size="30"> <input type="submit" name=submit value="Upload!"> </form> Warning: mkdir() [function.mkdir]: File exists in /home/content/d/a/r/daruano/html/secure/upload/test_form.php on line 2 Warning: move_uploaded_file(../../pages/test/checklist.pdf) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/content/d/a/r/daruano/html/secure/upload/test_form.php on line 11 Link to comment https://forums.phpfreaks.com/topic/97269-make-directory/#findComment-497800 Share on other sites More sharing options...
phpretard Posted March 21, 2008 Author Share Posted March 21, 2008 No more? Link to comment https://forums.phpfreaks.com/topic/97269-make-directory/#findComment-497828 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.