file uploading with register globals off
Posted: Wed Sep 10, 2003 8:44 am
[Admin Edit: Moved from the Passing Variables sticky]
Well, I've read through this thread, looked at the links, and I'm still not sure what is wrong.
Here is the form:
When you click on Submit ... it takes you to the following code:
The variable $userfile is blank no matter what value was submitted in the form for $userfile. So I tried the recommended fix:
However this coding just dies once it tries to execute. No error message displayed ... it just does nothing, and I was sure after reading the thread it would work. And it dies hard with the $_POST. The original code actually displays the Processing 'Add team' request. The new $_POST doesn't display this text at all ... nothing after the first use of $_POST works in fact.
I'm using version 4.1.2. Can anyone help me read my user's files? Thanks a bunch in advance for any and all help. I realize that I'm not using version 4.2 or up, but since the variable is blank, I just cannot figure out why its not passing through. Sorry if I've posted this to the wrong thread.
Galak
Well, I've read through this thread, looked at the links, and I'm still not sure what is wrong.
Here is the form:
Code: Select all
?><h1>Add new team</h1><?
// Form for the new team entry
$url = $PHP_SELF . "?show=addTeam".$sid;
echo "<form action="" .$url."" method="post" enctype="multipart/form-data">";
echo " <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="200000">";?>
<table width="90%" cellpadding="2" cellspacing="1" border="0" class="forumline" valign="top" align="center">
<tr>
<th class="thCornerL" height="25" nowrap="nowrap" align="center">Your team's html</th>
</tr>
<tr>
<td class="row3" align="center"><input type="file" name="userfile" size="70"> (max 200KB!)</td>
</tr>
</table>
<br />
<div align="center"><input type="submit" name="submit" value="Submit team" /></div>
<? echo "</form>";Code: Select all
if ($userfile != "none") {
// File einlesen
$openHandle = fopen($userfile, "r");
//$text = readfile($userfile);
$readHandle = fread($openHandle, filesize($userfile));
$data = addslashes($readHandle);
$data_BIG = strtoupper($data);
?>
<p>
<b>Processing 'Add team' request</b><br /><br />
- Scanning for team name: <b>
<? $team_name = getTeamName($data_BIG, $data);?>
<?= $team_name; ?></b><br>Code: Select all
if ($_POST['userfile'] != "none") {
// File einlesen
$openHandle = fopen($_POST['userfile'], "r");
//$text = readfile($_POST['userfile']);
$readHandle = fread($openHandle, filesize($_POST['userfile']));
$data = addslashes($readHandle);
$data_BIG = strtoupper($data);
?>
<p>
<b>Processing 'Add team' request</b><br /><br />
- Scanning for team name: <b>
<? $team_name = getTeamName($data_BIG, $data);?>
<?= $team_name; ?></b><br>I'm using version 4.1.2. Can anyone help me read my user's files? Thanks a bunch in advance for any and all help. I realize that I'm not using version 4.2 or up, but since the variable is blank, I just cannot figure out why its not passing through. Sorry if I've posted this to the wrong thread.
Galak