I need a single page with a file upload and a text area where the contents of the file are put.
At the moment I have a html file and a php file:
upload.html……
[COLOR=”Blue”]<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “
<html xmlns=”
<head>
<meta content=”text/html; charset=utf-8″ http-equiv=”Content-Type” />
<title>Type</title>
</head>
<body>
<form enctype=”multipart/form-data” action=”uploader.php” method=”POST”>
<input type=”hidden” name=”MAX_FILE_SIZE” value=”100000″ />
Choose a file to upload: <input name=”uploadedfile” type=”file” /><br />
<input type=”submit” value=”Upload File” />
<textarea name=”Values”></textarea>
</form>
</body>
</html>
uploader.php…….
[COLOR=”Blue”]<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “
<html xmlns=”
<head>
<meta content=”text/html; charset=utf-8″ http-equiv=”Content-Type” />
<title>Untitled 2</title>
</head>
<body>
<?php
$target_path = “uploads/”;
$target_path = $target_path . basename( $_FILES[‘uploadedfile’][‘name’]);
$filename = basename( $
if(move_uploaded_file($_FILES[‘uploadedfile’][‘tmp_name’], $target_path)) {
// echo “The file ” . $filename . ” has been uploaded”;
} else{
echo “There was an error uploading the file, please try again!”;
}
$myFile = “uploads/” . $filename;
$fh = fopen($myFile, ‘r’);
theData = fread($fh, filesize($myFile));
fclose($fh);
echo $theData;?>
</body>
</html>
I need the contents of the file selected to upload put into the textarea named “Values” on the same page as the upload form instead of on the uploader.php page.
Any help is appreciated! ?