Capture log-in name, rename & move file
I have an upload page script (not created by me). On the upload page a Browse Box appears along with a Submit Button.
Also, the logged-in User Name appears on the page, because of the line of code:
<?php ECHO $account->get_user_name(); ?>
How can I add the functionality where the uploaded file is automatically renamed with the logged-in User's Name (but the uploaded file keeps the same file extension?
On this forum someone directed me to a php Rename example as shown here:
How can this line of code be modified to capture the User Name and make it the (uploaded) file name?
And then move it to a certain directory?
Someone suggested this line of code:
Can someone please provide an example of how I can make all this happen together?
Thanks for your help, but...
I really do appreciate your assistance, however, I did get an error when I uploaded a text file.
Fatal error: Call to a member function on a non-object in /home/public_html/FileDirectory/uploader.php on line 100
I believe this is line 100:
$file_path = $upload_directory.$account->get_user_name().'.'.$ext;
I don't know what the error means. Thanks for any assistance you can provide. I look forward to your reply.