0

Hello everyone. I have a webserver that I would like to implement a file upload program on. I have been looking all over the internet for something that visually uploads files. I tried Megaupload 1.35 (SourceForge page), and it gave me error messages. The server has the latest versions of Apache, MySQL, and PHP. The errors I get go something like "The requested URL /cgi-bin/process.cgi was not found on this server." I followed the directions, everything is in the proper place. Please help me fix the error, or direct me to another program that can visually upload files. Thank you.

2
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by whiteyoh
0

Hi,

Do you mean something which allows you to manage files directly on the server? via a browser?

0

Not exactly. I want something where the users of the site can upload files to a publicly accessible directory, for sharing purposes.

1

I think this could be useful to you..

Code moved to attached file as is breaking view in FireFox. Please do not post such large code in the future or use attach option

Attachments
<?php

define("VERSION", "2.5.4"); // Current version of File Thingie.
define("INSTALL", "SIMPLE"); // Type of File Thingie installation. EXPANDED or SIMPLE.
define("MUTEX", $_SERVER['PHP_SELF']);
$ft = array();
$ft['settings'] = array();
$ft['groups'] = array();
$ft['users'] = array();
$ft['plugins'] = array();

# Settings - Change as appropriate. See online documentation for explanations. #
define("USERNAME", "whitep8"); // Your default username.
define("PASSWORD", "whitep8"); // Your default password.

$ft["settings"]["DIR"]               = "./guides/"; // Your default directory. Do NOT include a trailing slash!
$ft["settings"]["LANG"]              = "en"; // Language. Do not change unless you have downloaded language file.
$ft["settings"]["MAXSIZE"]           = 2000000; // Maximum file upload size - in bytes.
$ft["settings"]["PERMISSION"]        = 0644; // Permission for uploaded files.
$ft["settings"]["LOGIN"]             = TRUE; // Set to FALSE if you want to disable password protection.
$ft["settings"]["UPLOAD"]            = TRUE; // Set to FALSE if you want to disable file uploads.
$ft["settings"]["FILEACTIONS"]       = TRUE; // Set to FALSE if you want to disable file actions (rename, move, delete, edit, duplicate).
$ft["settings"]["HIDEFILEPATHS"]     = FALSE; // Set to TRUE to not pass downloads through File Thingie.
$ft["settings"]["DELETEFOLDERS"]     = FALSE; // Set to TRUE to allow deletion of non-empty folders.
$ft["settings"]["SHOWDATES"]         = FALSE; // Set to a date format to display last modified date (e.g. 'Y-m-d'). See http://dk2.php.net/manual/en/function.date.php 
$ft["settings"]["FILEBLACKLIST"]     = "ft2.php filethingie.js ft.css ft_config.php index.php"; // Specific files that will not be shown.
$ft["settings"]["FOLDERBLACKLIST"]   = "ft_plugins"; // Specifies folders that will not be shown. No starting or trailing slashes!
$ft["settings"]["FILETYPEBLACKLIST"] = "php phtml php3 php4 php5"; // File types that are not allowed for upload.
$ft["settings"]["FILETYPEWHITELIST"] = ""; // Add file types here to *only* allow those types to be uploaded.
$ft["settings"]["ADVANCEDACTIONS"]   = FALSE; // Set to TRUE to enable advanced actions like chmod and symlinks.
$ft["settings"]["LIMIT"]             = 0; // Restrict total dir file usage to this amount of bytes. Set to "0" for no limit.
$ft["settings"]["REQUEST_URI"]       = FALSE; // Installation path. You only need to set this if $_SERVER['REQUEST_URI'] is not being set by your server.
$ft["settings"]["HTTPS"] = FALSE; // Change to TRUE to enable HTTPS support.
$ft["settings"]["AUTOUPDATES"]       = "0"; // Number of days between checking for updates. Set to '0' to turn off.
$ft["settings"]["REMEMBERME"]        = FALSE; // Set to TRUE to enable the "remember me" feature at login.
$ft["settings"]["PLUGINDIR"]         = 'ft_plugins'; // Set to the path to your plugin folder. Do NOT include a trailing slash!
# Colours #
$ft["settings"]["COLOURONE"]         = "#326532"; // Dark background colour - also used on menu links.
$ft["settings"]["COLOURONETEXT"]     = "#fff"; // Text for the dark background.
$ft["settings"]["COLOURTWO"]         = "#DAE3DA"; // Brighter color (for table rows and sidebar background).
$ft["settings"]["COLOURTEXT"]        = "#000"; // Regular text colour.
$ft["settings"]["COLOURHIGHLIGHT"]   = "#ffc"; // Hightlight colour for status messages.

# Plugin settings #
$ft["plugins"]["search"] = TRUE;
$ft["plugins"]["edit"] = array(
 "settings" => array(
   "editlist" => "txt html htm css",
   "converttabs" => FALSE
 )
);
/*
$ft["plugins"]["tinymce"] = array(
  "settings" => array(
    "path" => "tinymce/jscripts/tiny_mce/tiny_mce.js",
    "list" => "html htm"
  )
);
*/

# Additional users - See guide at http://www.solitude.dk/filethingie/documentation/users #

/*
$ft['users']['REPLACE_WITH_USERNAME'] = array(
  'password' => 'REPLACE_WITH_PASSWORD', 
  'group' => 'REPLACE_WITH_GROUPNAME'
);
*/

# User groups for additional users -  - See guide at http://www.solitude.dk/filethingie/documentation/users #

/*
$ft['groups']['REPLACE_WITH_GROUPNAME'] = array(
  'DIR' => 'REPLACE_WITH_CUSTOM_DIR', 
);
*/


/**
 * Check if a login cookie is valid.
 *
 * @param $c
 *   The login cookie from $_COOKIE.
 * @return The username of the cookie user. FALSE if cookie is not valid.
 */
function ft_check_cookie($c) {
  global $ft;
  // Check primary user.
  if ($c == md5(USERNAME.PASSWORD)) {
    return USERNAME;
  }
  // Check users array.
	if (is_array($ft['users']) && sizeof($ft['users']) > 0) {
	  // Loop through users.
	  foreach ($ft['users'] as $user => $a) {
	    if ($c == md5($user.$a['password'])) {
	      return $user;
	    }
	  }
	}
	return FALSE;
}

/**
 * Check if directory is on the blacklist.
 *
 * @param $dir
 *   Directory path.
 * @return TRUE if directory is not blacklisted.
 */
function ft_check_dir($dir) {
	// Check against folder blacklist.
	if (FOLDERBLACKLIST != "") {
		$blacklist = explode(" ", FOLDERBLACKLIST);
		foreach ($blacklist as $c) {
      if (substr($dir, 0, strlen(ft_get_root().'/'.$c)) == ft_get_root().'/'.$c) {
        return FALSE;
      }      
		}
		return TRUE;
	} else {
		return TRUE;
	}
}

/**
 * Check if file actions are allowed in the current directory.
 *
 * @return TRUE is file actions are allowed.
 */
function ft_check_fileactions() {
  if (FILEACTIONS === TRUE) {
    // Uploads are universally turned on.
    return TRUE;
  } else if (FILEACTIONS == TRUE && FILEACTIONS == substr(ft_get_dir(), 0, strlen(FILEACTIONS))) {
    // Uploads are allowed in the current directory and subdirectories only.
    return TRUE;
  }
  return FALSE;  
}

/**
 * Check if file is on the blacklist.
 *
 * @param $file
 *   File name.
 * @return TRUE if file is not blacklisted.
 */
function ft_check_file($file) {
	// Check against file blacklist.
	if (FILEBLACKLIST != "") {
		$blacklist = explode(" ", FILEBLACKLIST);
		if (in_array(strtolower($file), $blacklist)) {
			return FALSE;
		} else {
			return TRUE;
		}
	} else {
		return TRUE;
	}
}

/**
 * Check if file type is on the blacklist.
 *
 * @param $file
 *   File name.
 * @return TRUE if file is not blacklisted.
 */
function ft_check_filetype($file) {
	$type = strtolower(ft_get_ext($file));
	// Check if we are using a whitelist.
	if (FILETYPEWHITELIST != "") {
		// User wants a whitelist
		$whitelist = explode(" ", FILETYPEWHITELIST);
		if (in_array($type, $whitelist)) {
			return TRUE;
		} else {
			return FALSE;
		}		
	} else {
		// Check against file blacklist.
		if (FILETYPEBLACKLIST != "") {
			$blacklist = explode(" ", FILETYPEBLACKLIST);
			if (in_array($type, $blacklist)) {
				return FALSE;
			} else {
				return TRUE;
			}
		} else {
			return TRUE;
		}
	}
}

/**
 * Check if a user is authenticated to view the page or not. Must be called on all pages.
 *
 * @return TRUE if the user is authenticated.
 */
function ft_check_login() {
	global $ft;
  $valid_login = 0;
	if (LOGIN == TRUE) {
		if (empty($_SESSION['ft_user_'.MUTEX])) {
		  $cookie_mutex = str_replace('.', '_', MUTEX);
			// Session variable has not been set. Check if there is a valid cookie or login form has been submitted or return false.
      if (REMEMBERME == TRUE && !empty($_COOKIE['ft_user_'.$cookie_mutex])) {
        // Verify cookie.
        $cookie = ft_check_cookie($_COOKIE['ft_user_'.$cookie_mutex]);
        if (!empty($cookie)) {
  			  // Cookie valid. Login.
  				$_SESSION['ft_user_'.MUTEX] = $cookie;
  				ft_redirect();          
        }
			}
			if (!empty($_POST['act']) && $_POST['act'] == "dologin") {
				// Check username and password from login form.
				if (!empty($_POST['ft_user']) && $_POST['ft_user'] == USERNAME && $_POST['ft_pass'] == PASSWORD) {
					// Valid login. 
					$_SESSION['ft_user_'.MUTEX] = USERNAME;
					$valid_login = 1;
				}
				// Default user was not valid, we check additional users (if any).
				if (is_array($ft['users']) && sizeof($ft['users']) > 0) {
					// Check username and password.
					if (array_key_exists($_POST['ft_user'], $ft['users']) && $ft['users'][$_POST['ft_user']]['password'] == $_POST['ft_pass']) {
						// Valid login.
						$_SESSION['ft_user_'.MUTEX] = $_POST['ft_user'];
						$valid_login = 1;
					}
				}
				if ($valid_login == 1) {
				  // Set cookie.
					if (!empty($_POST['ft_cookie']) && REMEMBERME) {
					  setcookie('ft_user_'.MUTEX, md5($_POST['ft_user'].$_POST['ft_pass']), time()+60*60*24*3);
					} else {
					  // Delete cookie
					  setcookie('ft_user_'.MUTEX, md5($_POST['ft_user'].$_POST['ft_pass']), time()-3600);
					}
					ft_redirect();
				} else {
  				ft_redirect("act=error");				  
				}
			}
			return FALSE;
		} else {
			return TRUE;
		}
	} else {
		return TRUE;
	}
}

/**
 * Check if a move action is inside the file actions area if FILEACTIONS is set to a specific director.
 *
 * @param $dest
 *   The directory to move to.
 * @return TRUE if move action is allowed.
 */
function ft_check_move($dest) {
  if (FILEACTIONS === TRUE) {
    return TRUE;
  }
  // Check if destination is within the fileactions area.
  $dest = substr($dest, 0, strlen($dest));
  $levels = substr_count(substr(ft_get_dir(), strlen(FILEACTIONS)), '/');
  if ($levels <= substr_count($dest, '../')) {
    return TRUE;
  } else {
    return FALSE;
  }
}

/**
 * Check if uploads are allowed in the current directory.
 *
 * @return TRUE if uploads are allowed.
 */
function ft_check_upload() {
  if (UPLOAD === TRUE) {
    // Uploads are universally turned on.
    return TRUE;
  } else if (UPLOAD == TRUE && UPLOAD == substr(ft_get_dir(), 0, strlen(UPLOAD))) {
    // Uploads are allowed in the current directory and subdirectories only.
    return TRUE;
  }
  return FALSE;  
}

/**
 * Check if a user exists.
 *
 * @param $username
 *   Username to check.
 * @return TRUE if user exists.
 */
function ft_check_user($username) {
  global $ft;
  if ($username == USERNAME) {
    return
0

actually, this will be good for your management, but i do have another which is just for user view

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.