Jump to content

Make Directory


phpretard

Recommended Posts

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

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

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

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.