Setting up this new server is becoming a pain!
now thats its finally up, and mostly working... well, i still have a few problems
i have this page:
<!-- m --><a class="postlink" href="http://24.238.145.68/public/images/index.php">http://24.238.145.68/public/images/index.php</a><!-- m -->
if you click "upload" or "Download ", notthing happens... but, it working before. here is the script:
<?
$extlimit = "yes"; //Do you want to limit the extensions of files uploaded
$limitedext = array(".jpg",".jpeg",".gif",".png", ".swf"); //Extensions you want files uploaded limited to.
$sizelimit = "yes"; //Do you want a size limit, yes or no?
$sizebytes = "200000"; //size limit in bytes
$dl = "http://24.238.145.68/public/images/upload"; //url where files are uploaded
$absolute_path = "C:/phpdev/www/public/images/upload"; //Absolute path to where files are uploaded
$websiteurl = "http://24.238.145.68/public/images/"; //Url to you website
$websitename = "Images";
switch($action) {
default:
echo"
<html>
<head>
<title>User Upload/Download Resource Center></title>
</head>
<body>
<a href=http://www.htmlforums.com/archive/index.php/$PHP_SELF?action=upload>Upload File</a><br>
<a href=http://www.htmlforums.com/archive/index.php/$PHP_SELF?action=Download >Download File</a><br>
<br><br>
</body>
</html>";
break;
case "Download ":
echo "
<html>
<head>
<title>File Download </title>
</head>
<body>
<a href=http://www.htmlforums.com/archive/index.php/$PHP_SELF?action=upload>Upload File</a> <a href=$websiteurl>Return to $websitename</a>";
$list = "<table width=700 border=1 bordercolor=#000000 style=\"border-collapse: collapse\">";
$list .= "<tr><td width=700><center><b>Click To Download -Note: you may need to choose SAVE TARGET
As...</b></center></td></tr>";
$dir = opendir($absolute_path);
while($file = readdir($dir)) {
if (($file != "..") and ($file != ".")) {
//Download files with spaces fix by Kokesh
$list .= "<tr><td width=700><a href='http://www.htmlforums.com/archive/index.php/$dl/$file'>$file</a></center></td></tr>";
}
}
$list .= "</table>";
echo $list;
echo"
<br><br>
</body>
</html>";
break;
case "upload":
echo"
<html>
<head>
<title>File Upload</title>
</head>
<body>
<form method=POST action=$PHP_SELF?action=doupload enctype=multipart/form-data>
<p>File to upload:<br>
<input type=file name=file size=30>
<p><button name=submit type=submit>
Upload
</button>
</form>
<br><br>
</body>
</html>";
break;
//File Upload
case "doupload":
$dir = "dir";
if ($file != "") {
if (file_exists("$absolute_path/$file_name")) {
die("File already exists");
}
if (($sizelimit == "yes") && ($file_size > $sizebytes)) {
die("File is to big. It must be $sizebytes bytes or less.");
}
$ext = strrchr($file_name,'.');
if (($extlimit == "yes") && (!in_array($ext,$limitedext))) {
die("The file you are uploading doesn't have the correct extension.");
}
@copy($file, "$absolute_path/$file_name") or die("The file you are trying to upload couldn't be copied to the server");
} else {
die("Critical ERROR 2. Either you didn't Input a filename, or you are using an extension that is not uploadable. Only upload
txt and script files, which include .jpg, .gif, .png. Thank you");
}
echo "
<html>
<head>
<title>File Uploaded</title>
</head>
<body>";
echo $file_name." was uploaded";
echo "<br />";
echo "The path to your file is <!-- m --><a class="postlink" href="http://24.238.145.68/public/images/upload/">http://24.238.145.68/public/images/upload/</a><!-- m -->" . $file_name;
echo "<br>
<a href=http://www.htmlforums.com/archive/index.php/$PHP_SELF?action=upload>Upload Another File</a>
<a href=http://www.htmlforums.com/archive/index.php/$PHP_SELF?action=Download > Download File</a>
</body>
</html>";
break;
}
?>
could it be a problem with Register_all_globals or w/e its called?well just check the source from the browser the first time you view the page, you will see if $PHP_SELF has been replace with the correct value or a blank string.
now thats its finally up, and mostly working... well, i still have a few problems
i have this page:
<!-- m --><a class="postlink" href="http://24.238.145.68/public/images/index.php">http://24.238.145.68/public/images/index.php</a><!-- m -->
if you click "upload" or "Download ", notthing happens... but, it working before. here is the script:
<?
$extlimit = "yes"; //Do you want to limit the extensions of files uploaded
$limitedext = array(".jpg",".jpeg",".gif",".png", ".swf"); //Extensions you want files uploaded limited to.
$sizelimit = "yes"; //Do you want a size limit, yes or no?
$sizebytes = "200000"; //size limit in bytes
$dl = "http://24.238.145.68/public/images/upload"; //url where files are uploaded
$absolute_path = "C:/phpdev/www/public/images/upload"; //Absolute path to where files are uploaded
$websiteurl = "http://24.238.145.68/public/images/"; //Url to you website
$websitename = "Images";
switch($action) {
default:
echo"
<html>
<head>
<title>User Upload/Download Resource Center></title>
</head>
<body>
<a href=http://www.htmlforums.com/archive/index.php/$PHP_SELF?action=upload>Upload File</a><br>
<a href=http://www.htmlforums.com/archive/index.php/$PHP_SELF?action=Download >Download File</a><br>
<br><br>
</body>
</html>";
break;
case "Download ":
echo "
<html>
<head>
<title>File Download </title>
</head>
<body>
<a href=http://www.htmlforums.com/archive/index.php/$PHP_SELF?action=upload>Upload File</a> <a href=$websiteurl>Return to $websitename</a>";
$list = "<table width=700 border=1 bordercolor=#000000 style=\"border-collapse: collapse\">";
$list .= "<tr><td width=700><center><b>Click To Download -Note: you may need to choose SAVE TARGET
As...</b></center></td></tr>";
$dir = opendir($absolute_path);
while($file = readdir($dir)) {
if (($file != "..") and ($file != ".")) {
//Download files with spaces fix by Kokesh
$list .= "<tr><td width=700><a href='http://www.htmlforums.com/archive/index.php/$dl/$file'>$file</a></center></td></tr>";
}
}
$list .= "</table>";
echo $list;
echo"
<br><br>
</body>
</html>";
break;
case "upload":
echo"
<html>
<head>
<title>File Upload</title>
</head>
<body>
<form method=POST action=$PHP_SELF?action=doupload enctype=multipart/form-data>
<p>File to upload:<br>
<input type=file name=file size=30>
<p><button name=submit type=submit>
Upload
</button>
</form>
<br><br>
</body>
</html>";
break;
//File Upload
case "doupload":
$dir = "dir";
if ($file != "") {
if (file_exists("$absolute_path/$file_name")) {
die("File already exists");
}
if (($sizelimit == "yes") && ($file_size > $sizebytes)) {
die("File is to big. It must be $sizebytes bytes or less.");
}
$ext = strrchr($file_name,'.');
if (($extlimit == "yes") && (!in_array($ext,$limitedext))) {
die("The file you are uploading doesn't have the correct extension.");
}
@copy($file, "$absolute_path/$file_name") or die("The file you are trying to upload couldn't be copied to the server");
} else {
die("Critical ERROR 2. Either you didn't Input a filename, or you are using an extension that is not uploadable. Only upload
txt and script files, which include .jpg, .gif, .png. Thank you");
}
echo "
<html>
<head>
<title>File Uploaded</title>
</head>
<body>";
echo $file_name." was uploaded";
echo "<br />";
echo "The path to your file is <!-- m --><a class="postlink" href="http://24.238.145.68/public/images/upload/">http://24.238.145.68/public/images/upload/</a><!-- m -->" . $file_name;
echo "<br>
<a href=http://www.htmlforums.com/archive/index.php/$PHP_SELF?action=upload>Upload Another File</a>
<a href=http://www.htmlforums.com/archive/index.php/$PHP_SELF?action=Download > Download File</a>
</body>
</html>";
break;
}
?>
could it be a problem with Register_all_globals or w/e its called?well just check the source from the browser the first time you view the page, you will see if $PHP_SELF has been replace with the correct value or a blank string.