Hey, I have an upload script that currently
-uploads to any desired folder
-prohibits index and php files
-Doesn't allow overwriting of files
-Displays error-specific message when error
-Displays success message when success
What I would like for my script to do is display a link to the file that was just uploaded. My idea is i just put the path to my upload folder in text, and reprint the filename at the end. Anybody know how to do that?
Heres the script:
<html>
<head>
<title>pheterson.com - upload script</title>
<META HTTP-EQUIV=Refresh CONTENT="10; URL=http://www.pheterson.com/upload/">
</head>
<?
/*upload.php*/
if ($img1_name != "") {
if(!(file_exists("/home/pheterso/www/upload/$img1_name"))){
if(!(eregi("index.htm|index.html|php",$img1_name))){
@copy("$img1", "/home/pheterso/www/upload/$img1_name")
or die("<b>No Copy!</b><br>There was a problem copying your file. Most likely the server timed out. Try again or give up.");
}else{print "<b>No Copy!</b><br><br>Uploading of index and php files is prohibited.<br>(index.html, index.htm, and any file with a .php extension.)";exit;}
}else{print "<b>No Copy!</b><br>File Already Exists. Please rename your file and try again.";exit;}
}else {
die("<b>No input file!</b><br>You did not select a file to upload.");
}
?>
<b>Your file has been uploaded successfully. Please wait to continue.<br><br>
Or... If you're a lazy ass, <a href="http://www.pheterson.com/upload/">click here</a>.
</html>