logo-dw

Go Back   Dreamweaver Club Forums > Community Talk > Job Offers and Inquiries
Register FAQ Members List Search Today's Posts Mark Forums Read

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 11-26-2010, 04:58 PM   #1
Josh
 
Join Date: Oct 2010
Posts: 73
Default Small job - when user uploads file, tell me which user uploaded it

Hi,

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:
<?php
session_start
();
   
// 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 '../../onlinestage.co.uk/uploads/'// 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.
   
if(!in_array($ext,$allowed_filetypes))
      die(
'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)
      die(
'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.
   
if(!is_writable($upload_path))
      die(
'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))
 
         echo 
'Your file upload was successful, view the file <a href="' $upload_path $filename '" title="Your File">here</a>'// It worked.
      
else
         echo 
'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.

Thanks,

Josh

my email is josh_everett6@hotmail.co.uk

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


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:12 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com