I have a problem that I'm not sure how to resolve. My issue is that I have to setup a page that allows coworkers at my office to be able to upload meeting documents and such. They should be able to upload them themselves and the user viewing the document should be able to download them to their computer. The user on the other should not be able to upload documents. Should I just create a folder in ftp and then create a script to let only certain people logged on upload documents? Not sure how to go about this. I want to make it very easy for them to upload the documents.


Yes, the easiest way for you would be to use ftp and set the user rights to download only and the coworkers rights to upload and download.
FTP would be fast but the interface isn't that nice.
You could also use free File Uploader-Scripts. So you do not need to code something.
You will find many of them via Google. The first I found was this for example:

I think you easily use google docs since making permission for each user would be a drag unless you have a word press based website ...

You need a php uploader, password controlled, and preferably only those who do the uploading know the page even exists. If they upload to a folder with no index page and your server shows the folder contents when there is no index page, then everyone can see the documents to download them, so everything becomes available to everyone. You could separate things on a topic by topic basis by having the destination folder dependant on who does the uploading, or rather who they say they are. I wrote such a script for a client a while ago.


Try this in php:

//The password
$password = '123abc';
if ($handle = scandir('docs/')) {
   foreach ($handle as $file)
          if ($file != "." && $file != ".." && $file != ".htaccess")
		$doc .= '<li><a href="docs/'.$file.'">'.$file.'</a></li>';

print $doc;

<?php if($_GET['action'] == 'upload'){
print '<form action="'.$_SERVER["PHP_SELF"].'?action=chkpw" method="post">
  <p>To upload a file you need to enter your password.</p>
  Password: <input type="password" name="pw" /><br />
  <input type="submit" value="Submit" />

<?php if($_GET['action'] == 'chkpw'){

if($_POST['pw'] == $password){
print '<p>Please Choose a file to upload.<br /></p>';
print '
<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'?action=uploadfile" method="post">
<input type="file" name="uploaded" /><br />
  <input type="hidden" name="password" value="'.$_POST["pw"].'" />
  <input type="submit" value="Submit" />
else {print '<p>Wrong Password</p>';}


if($_GET['action'] == 'uploadfile' && $_POST['password'] == $password){

$target = "docs/"; 
 $target = $target . basename( $_FILES['uploaded']['name']) ; 
 if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) 
 echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
 else {
 echo "Sorry, there was a problem uploading your file.";


<?php if($_GET['action'] != ''){} else{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=upload">Upload</a>';
} ?>

I hope it works,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.