Dadparvar
Well-known member
Hi,
In a php file, where there is upload process (not related to xenforo's upload process) I have this code:
That will cause the file be uploaded in "uploads" folder.
How to change it, so that when user with user_id 1 upload the file, then it be uploaded in folder "1" and if user 2 did, then in "2" and so...
I tested this code, bu now worked:
Thanks in advance
In a php file, where there is upload process (not related to xenforo's upload process) I have this code:
Code:
if(move_uploaded_file($_FILES['upl']['tmp_name'], 'uploads/'.$_FILES['upl']['name'])){
echo '{"status":"success"}';
exit;
}
That will cause the file be uploaded in "uploads" folder.
How to change it, so that when user with user_id 1 upload the file, then it be uploaded in folder "1" and if user 2 did, then in "2" and so...
I tested this code, bu now worked:
PHP:
$user = XenForo_Visitor::getInstance()->toArray();
$userId = $user['user_id'];
if(move_uploaded_file($_FILES['upl']['tmp_name'], $userId.'/'.$_FILES['upl']['name'])){
echo '{"status":"success"}';
exit;
}
Thanks in advance