What i'm tryin' to do is the following
I have sessions setup with in my website.. What i want them to be able to do is upload pics to the server using the following form
form enctype="multipart/form-data" action="sendpics.php" method="POST">
<input name="username" type="hidden" value="<? echo $_SESSION['username']; ?>">
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>
[\PHP]
This is from php.net it does work actually but not what i want it to do
next part is the upload script..
What i want it to do is say if the user jondoe logins with his account with a username of jond
His session name is jond
Now here is the script
[code=php]
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$username=$_POST["username"];
$uploaddir = '/var/www/htdocs/beta/members/photos/$username/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>
[\PHP]
I want it to upload to the users directory that I have made for him/her.
I tried chmoding all the folders that go to the dest. of the folder still no go..
Any ideas?