From:             azz0r at wuggawoo dot co dot uk
Operating system: Unknown
PHP version:      4.3.10
PHP Bug Type:     Variables related
Bug description:  Header function doesnt use variables if $_FILE is used

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.

-- 
Edit bug report at http://bugs.php.net/?id=32449&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32449&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32449&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32449&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=32449&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=32449&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=32449&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=32449&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=32449&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=32449&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=32449&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=32449&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=32449&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=32449&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32449&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=32449&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=32449&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=32449&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32449&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=32449&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32449&r=mysqlcfg

Reply via email to