I found this code somewhere and tried to edit it:::::
<html>
<head><title>Upload</title></head>
<body>
<?php
require("fileupload-class.php");
$path = "../uploads/";
$fullpath ="D:\htdocs\pep\ag101\setup\uploads";
$upload_file_name = "userfile";
$acceptable_file_types = "";
$default_extension = ".MAC";
$mode = 3;
if ($_REQUEST['submitted']) {
$my_uploader = new uploader;
$my_uploader->max_filesize(1000000);
$my_uploader->max_image_size(500, 500); // max_image_size($width, $height)
if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) {
$success = $my_uploader->save_file($path, $mode);
}
rename("$fullpath/$upload_file_name", "$fullpath/$fname$upload_file_name");
// I gave up on this - - move_uploaded_file("$path/$upload_file_name", "$path/$fname$upload_file_name");
if ($success) {
print($my_uploader->file['name'] . " was successfully uploaded! <a href=\"" . $_SERVER['PHP_SELF'] . "\">Try Again</a><br>");
if(ereg("image", $my_uploader->file['type'])) {
echo "<img src=\"" . $path . $my_uploader->file['name'] . "\" border=\"0\" alt=\"\">";
} else {
$fp = fopen($path . $my_uploader->file['name'], "r");
while(!feof($fp)) {
$line = fgets($fp, 255);
echo $line;
}
if ($fp) { fclose($fp); }
}
} else {
if($my_uploader->errors) {
while(list($key, $var) = each($my_uploader->errors)) {
echo $var . "<br>";
}
}
}
}
?>
<form enctype="multipart/form-data" action="<?= $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="submitted" value="true">
Upload this file:<br>
<input name="<?= $upload_file_name; ?>" type="file">
<br><br>
<input type="submit" value="Send File">
</form>
<hr>
<?php
if ($acceptable_file_types) {
print("This form only accepts <b>" . str_replace("|", " or ", $acceptable_file_types) . "</b> files\n");
}
?>
</body>
</html>
Thank YOU!!!