I'm using this upload script, and am wondering if it can be modified to change the destination of the uploaded file.
Currently I can only upload to a local folder, is it possible to changev this so I can upload to another directory at another url? If os how/where?
Thanks. Here's part of the code:
<?
/*
*/
// Begin options
$allow_file_deletion = true; // To allow visitors to delete files, leave this at true; otherwise, change it to false
$file_extensions = array(".doc"); // Add or delete the file extensions you want to allow
$file_extensions_list = "doc"; // Type the same as above, without the quotes separating them
$max_length = 50; // The maximum character length for a file name
$maximum_file_size = "2048000"; // In bytes
$upload_log_file = "upload_log.txt"; // Change this to the log file you want to use
// End options
$folder_directory = "http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"]);
$message = "";
$set_chmod = 0;
$site_uri = "http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"];
$upload_directory = "C:/local folder/";
$upload_uri = $folder_directory."C:/local folder/";
if($allow_file_deletion == true) $status = "enabled";
else $status = "disabled";
if($_REQUEST["delete"] && $allow_file_deletion) {
$resource = fopen($upload_log_file,"a");
fwrite($resource,date("F d, Y / h:i:sa")." - ".$_REQUEST["delete"]." deleted by ".$_SERVER["REMOTE_ADDR"]."\n");
fclose($resource);
if(strpos($_REQUEST["delete"],"/.") > 0);
elseif(strpos($_REQUEST["delete"],$upload_directory) === false);
elseif(substr($_REQUEST["delete"],0,6) == $upload_directory) {
unlink($_REQUEST["delete"]);
$message = "File has been deleted.";
header("Location: $site_uri?message=$message");
}
}
elseif($_FILES["userfile"]) {
$resource = fopen($upload_log_file,"a");