php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32449 Header function doesnt use variables if $_FILE is used
Submitted: 2005-03-25 00:07 UTC Modified: 2005-03-25 01:15 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: azz0r at wuggawoo dot co dot uk Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.3.10 OS: Unknown
Private report: No CVE-ID: None
 [2005-03-25 00:07 UTC] azz0r at wuggawoo dot co dot uk
Description:
------------
Basically I have a form where the user submits a file.

If a file is submitted in the header function is used it refuses to recognize the variables and thus goes to the wrong page.

I have echoed these variables before and commented out the header function and theyre fine. As a work around Ive had to code a function that redirects using javascript.

Reproduce code:
---------------
	{$exploded = explode(".", $_FILES['attachment']['name']);
	$original_name = $exploded[0];
	$extension = strtolower($exploded[count($exploded) - 1]);
	$mime = $_FILES['attachment']['type'];
	$size = $_FILES['attachment']['size'];
	
	query("INSERT INTO $forumzDB.forumz_attachments (`aid`, `extension`, `uid`, `pid`, `time`, `mime`, `size`, `views`, `original_name`) VALUES ('', '$extension', '$uid', '$pq->pid', '$time', '$mime', '$size', '1', '$original_name')") or die_query(7); 
 	$aid = mysql_fetch_object(query("SELECT aid, time, extension FROM $forumzDB.forumz_attachments WHERE uid = '$uid' ORDER BY aid DESC LIMIT 1")) or die_query(8);//last attachment by user - we want the aid to brand the file

	$filename = "$aid->aid$aid->time.$extension";
	copy($_FILES['attachment']['tmp_name'], "images/attachments/$filename"); 
	unlink($_FILES['attachment']['tmp_name']);}}

	if($forum_properties['attachments'] == 1)
	{success_box("Your post has been added. $filebig", "".$forum_properties['base_url']."/thread/$tid/$pages#$pq->pid");}
	else
	{header("Location: ".$forum_properties['base_url']."/thread/$tid/$pages#$pid");}

Expected result:
----------------
Ideally I wouldnt need the end if statement and it would use the header command directly thus taking the user straight to the page.

Actual result:
--------------
The header command goes to the base url but ignores the variables.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-25 01:15 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 04 15:01:30 2024 UTC