On Wed, 4 Aug 2004 14:35:41 +0100 (BST), Mikey <[EMAIL PROTECTED]> 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
1) According to standards, you're supposed to give a full absolute URL
for the Location header
2) You shouldn't need the newlines in the header call
>
> 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']})<br>\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<br>\n");
> ociexecute ($sth)
> or die ("Coudn't execute SQL: $sql<br>\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.
>
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php