I opened a question about mkdir a couple min ago. I got that fixed. So here's question 2.
Now that I have the mkdir coding working, I tried implementing it inside my original file.
I've tried to debug the code, but whatever I do it's not working.
Here's the code I'm trying to use:
<?php
if (isset($_FILES['profilepic'])) {
if (((@$_FILES["profilepic"]["type"]=="image/jpeg") || (@$_FILES["profilepic"]["type"]=="image/png") || (@$_FILES["profilepic"]["type"]=="image/gif"))&&(@$_FILES["profilepic"]["size"] < 1048576)) { //1 Megabyte
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$rand_dir_name = substr(str_shuffle($chars), 0, 15);
mkdir("userdata/profile_pics/$rand_dir_name", 0777, true);
}
else
{
}
}
?>
<p>UPLOAD YOUR PROFILE PHOTO:</p> <br />
<form action="" method="POST" enctype="multipart/formdata">
<img src="./img/default_pic.png" width="70" />
<input type="file" name="profilepic" /><br /><br />
<input type="submit" name="uploadpic" value="Upload Photo"><br />
</form>
Some background info, I'm trying to create a profile photo upload page. It should, whenever I upload a image, create a folder with a randomly generated name. The thing is it does not create the folder.
Any ideas? Thanks, in advance.