Re: Setting redirect after HTTP upload

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
 
You cannot use header function if u want to output anything on that page. If you still want to redirect the page. Use <? ob_start(); ?> at the top of the page.
 
.....SuDeEp..... 

Mikey <frak@xxxxxxxxxx> wrote:
Hi NG,

Was wondering if anyone knew how why my code would fail to re-direct to
another page and whether this may be related to the fact that I have done an
HTTP upload?

On several pages, I perform a dB update and then re-direct to another page
using:

header ("Location: /some_url.php\n\n");
// \n\n included cos I read it in the manual years ago

And this works as expected. However, on one page, I upload either one or
two files via HTTP and process them, however, once the files have been
processed and the database has been updated, the page is blank and it says
it is done.

It have put in an echo just above the header() call and the re-direct fails
as expected ("Cannot modify headers, etc...") so their can't be any other
output created by my script.

I have included the complete listing of the code that I am trying to execute
below - I have already through all the online comments in the manual
regarding both header() and HTTP uploads, but have found nothing that
helps.

Ta!

frak!

if (isset ($_REQUEST['sub_symbol']))
{
$sp = "/images/symbols/";

// Are there files to process?
if (count ($_FILES) > 0)
{
if (isset ($_FILES['Image']) && $_FILES['Image']['tmp_name'] != "")
{
$img_name = $_FILES['Image']['name'];
while (file_exists ($_SITEPATH.$sp.$img_name))
$img_name = uniqid ("img").".jpg";
$img = new Photograph ();
$img->open ($_FILES['Image']['tmp_name']);
$img->create ($_SITEPATH.$sp, "", $img_name);
}
if (isset ($_FILES['Eps']) && $_FILES['Eps']['tmp_name'] != "")
{
$eps_name = "/eps/symbols/".$_FILES['Eps']['name'];
while (file_exists ($_SITEPATH.$eps_name))
$eps_name = "/eps/symbols/".uniqid ("eps").".eps";
move_uploaded_file ($_FILES['Eps']['tmp_name'], $_SITEPATH.$eps_name)
or die ("Couldn't move uploaded
file...({$_FILES['Eps']['tmp_name']})
\n");
}
}

if (!isset ($img_name))
$img_name = $_REQUEST['old_img_path'];
else
$img_name = $sp.$img_name;
if (!isset ($eps_name))
$eps_name = $_REQUEST['old_eps_path'];

if ($_REQUEST['sub_symbol'] == "Save Changes")
{
$sql = "UPDATE tblSymbols SET \"swmName\"='".safeSQL
($_REQUEST['swmName'])."', \"swmImgPath\"='$img_name',
\"swmEpsPath\"='$eps_name' WHERE \"irpSymbol\"=".$_REQUEST['irpSymbol'];
}
else
{
$sql = "INSERT INTO tblSymbols VALUES (0, '".safeSQL
($_REQUEST['swmName'])."', '$img_name', '$eps_name')";
}
$sth = ociparse ($conn, $sql)
or die ("Couldn't parse SQL: $sql
\n");
ociexecute ($sth)
or die ("Coudn't execute SQL: $sql
\n");
header ("Location: /admin/symbols.html\n\n");
exit ();
}



-- 
Recruitment consultants are like morning dew - soggy and wet in the
morning and non-existent by the afternoon.

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux