View Single Post
Old 11-26-2010, 04:58 PM   #1
Join Date: Oct 2010
Posts: 73
Default Small job - when user uploads file, tell me which user uploaded it


It's only a small job, or atleast I think it is. But i'm just not having any luck with it.

I have an upload script where to get the upload page the user must be logged in. I have the login/logout/register all in place so all my databases are setup, so when the user logs in a session is set - ['username']

What I want to happen is when the user uploads a video file to me, it tells me which username has uploaded the file.

The php code is below:

PHP Code:
// Configuration - Your Options
$allowed_filetypes = array('.avi','.mpg','.flv','.swf','.zip','.wmv','.mp4','.vob','.3g2','3gp','.rm'); // These will be the types of file that will pass the validation.
$max_filesize 12024288// Maximum filesize in BYTES (currently 12MB).
$upload_path '../../'// The place the files will be uploaded to (currently a 'files' directory).
$filename $_FILES['userfile']['name']; // Get the name of the file (including file extension).
$ext substr($filenamestrpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename.
   // Check if the filetype is allowed, if not DIE and inform the user.
'The file you attempted to upload is not allowed.');
// Now check the filesize, if it is too large then DIE and inform the user.
if(filesize($_FILES['userfile']['tmp_name']) > $max_filesize)
'The file you attempted to upload is too large.');
// Check if we can upload to the specified path, if not DIE and inform the user.
'You cannot upload to the specified directory, please CHMOD it to 777.');
// Upload the file to your specified path.
if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path $filename))
'Your file upload was successful, view the file <a href="' $upload_path $filename '" title="Your File">here</a>'// It worked.
'There was an error during the file upload.  Please try again.'// It failed :(.
and this is the form code.

HTML Code:
<form action="/includes/uploader.php" method="post" enctype="multipart/form-data"> <p align="center"> <label for="file">Select a file please:</label> <input type="file" name="userfile" id="file"> <br /> <button>Upload File</button> <p align="center"></form>
I am willing to pay somebody to alter this code for me for a small price as I know it's just a case of a few bits of code that I don't know where to place or what code is needed.
I need to know the username that has uploaded the file, and where abouts would I find out which username has uploaded it?
Please tell me how much you would like to get this done.



my email is

Last edited by Josh; 11-26-2010 at 05:02 PM..
Josh is offline   Reply With Quote