Jump to content

Iam in need of some help, Small problem i think/?...issue with mkdir

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
jonathanfla

jonathanfla

    Newbie

  • Members
  • Pip
  • 4 posts
Im in the process of setting up a social media site , Just switched from basic hosting to Dedicated Server
Everything was working till i switched .

I have a basic join forum and email activation , On the register.php file it tell script to make a directory mkdir into member/folder like this below, But it make the folder for the id of that user but will not let them upload any images?. At first it wouldnt even make a folder but i found out it was a permissions issue with my server i fixed it , im guessing the upload is also a permission's issue ? please help

Im running a dedicated server with godaddy, On centOs w/ Plesk Panel 9.3.0
-------------------------------------------------------------------------------------------

$id = mysql_insert_id();

// Create directory(folder) to hold each user's files(pics, MP3s, etc.)
mkdir("members/$id", 0755);

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
Try placing this at the top of your script to enable errors:
ini_set('display_errors',1);
error_reporting(E_ALL);

What errors does it specifically show when they cannot upload?

The folder should have writable permissions, such as 766 which could be a problem too as dedicated servers tend to have no permissions pre set up for you. mkdir() should also return FALSE on error, you should check for that as well.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
jonathanfla

jonathanfla

    Newbie

  • Members
  • Pip
  • 4 posts
No it doesn't specifie a error it just say your upload succesful and should picture should apear in a little bit, But it never shows. Before i went dedicated it worked.?
It just never creates the file in the fold specified /members/$id
Im new to php what is 766?

#4
jonathanfla

jonathanfla

    Newbie

  • Members
  • Pip
  • 4 posts
Bump anyone please help

#5
jonathanfla

jonathanfla

    Newbie

  • Members
  • Pip
  • 4 posts
bump help.

#6
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts

jonathanfla said:

Bump anyone please help

jonathanfla said:

bump help.

Please famailiarize yourself with our FAQ. Especially the part about bumping your threads.
CodeCall Rules

#7
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts

jonathanfla said:

No it doesn't specifie a error it just say your upload succesful and should picture should apear in a little bit, But it never shows. Before i went dedicated it worked.?
It just never creates the file in the fold specified /members/$id
Im new to php what is 766?

Your logic most likely does not allow for the program to check if the file is created first. mkdir() should always return FALSE on error, you can make sure you catch any error while it happens with that specific code here in this example:
$directory = "members/$id";
if(is_writable($directory) == false || mkdir($directory) == false) { 
   trigger_error("members/$id cannot be written to!", E_USER_ERROR);
} else {
  print "Your upload was successful";
}
There is likely an error in your code that is causing the problem that you had not shown us.

If all else fails, run
echo `whoami`;
and
echo `ls -la members/$id`;
to check the permissions of the said folder, and especially if you are running under the same user as the files you are trying to write to
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.