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);
Iam in need of some help, Small problem i think/?...issue with mkdir
Started by jonathanfla, Oct 28 2010 12:29 AM
6 replies to this topic
#1
Posted 28 October 2010 - 12:29 AM
|
|
|
#2
Posted 28 October 2010 - 12:34 AM
Try placing this at the top of your script to enable errors:
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.
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.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#3
Posted 28 October 2010 - 12:49 AM
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?
It just never creates the file in the fold specified /members/$id
Im new to php what is 766?
#4
Posted 28 October 2010 - 01:20 AM
Bump anyone please help
#5
Posted 28 October 2010 - 02:03 PM
bump help.
#6
Posted 28 October 2010 - 02:11 PM
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
Posted 29 October 2010 - 05:22 PM
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?
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.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.


Sign In
Create Account

Back to top









