|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-03-25 01:15 UTC] sniper@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 30 20:00:01 2025 UTC |
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.