View Full Version : Easy uploader needed

01-18-2010, 09:55 PM
Warning: I'm new at PHP.

That said, here's what I need. I need to share files with clients often. The current solution is upload the file to an FTP server and then forward the client a URL that will directly download the file.

Basics of what I need:
- simple web interface that would allow anyone to upload files
- show the progress of the file upload
- when upload is complete return a download link that can be copied and emailed
- secure

Extras that would be nice:
- limit files to ZIP or PDF
- dropdown menu that would allow the uploader to select the client they are uploading for (this would then place the file in the respective client's folder)

So can it be done and how hard is it to do?

01-18-2010, 10:14 PM
Yes it's possible, pretty easy actually, as long as you drop the progress bar requirement. You can use Ajax to display a progress bar but that's going to complicate matters. My advice for someone who has never programmed in PHP before would be to get it all working without the progress bar first, then maybe revisit the application later.

You want to look into file uploads:


And sessions to limit access to the website:


01-18-2010, 10:45 PM
Or maybe something premade might give you a starting point.


There is a lot more out there but if you search for php file manager.

01-19-2010, 11:38 AM
displaying the form.

<FORM ENCTYPE="multipart/form-data" ACTION="upload.php" METHOD=POST>
Upload this file: <INPUT NAME="file_up" TYPE="file">
<INPUT TYPE="submit" VALUE="Send File"></FORM>

Here is the php code.

<? //upload.php
echo $_FILES[file_up][name];
if ($_FILES[file_up][size]>250000){$msg=$msg."Your uploaded file size is more than 250KB not allowed. \n";

if (!($_FILES[file_up][type] =="file/zip" OR $_FILES[file_up][type] =="file/pdf")){$msg=$msg."Just ZIP or PDF. allowed \n";

$add="upload/$file_name "; // upload is the directory name.

if(move_uploaded_file ($_FILES[file_up][tmp_name], $add)){
// a thanks message here.
}else{echo "Failed to upload file Contact Site admin to fix the problem \n";}

}else{echo $msg;}