I’m making a single php file that takes a file uploaded by the user then it displays certain contents of the file. I’ve tried a number of approaches but keep getting messed up. What’s the best way to have a single page both be the form submitting and the form sending? The gist of what I’ve got now is:
<?php
echo '<html><body>'
if(isset($_FILE) && isset(search))
{
fopen($_FILE['file'])
...
}
else
{
<form type="POST" enctype="multipart/form-data" action="samepage.php" />
Select file: <input type="file" name="file" /><br />
Enter string: <input type="text" name="string" /><br />
<input type="submit" value="send" />
}
$_FILE = $_POST = null;
I know this codes screwy but I’ve tried a number of different ways and I’m stuck!

I would just say, because that is the way it is man!!!