---
title: "header problem"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/57942-header-problem"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "Leon"
published: "2002-11-04T11:12:49.000Z"
updated: "2002-11-04T11:37:45.000Z"
replies: 1
views: 235
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/php/57942-header-problem"
---

# header problem

## #1 — Leon, 2002-11-04T11:12Z

Den vill inte svälja den här koden... säjer så här

Warning: Unable to create '..\\PhotoArchive\\A2-0.jpg': Permission denied in /home/leon/public_html/substitute/admin/adminphoto.php on line 56

Warning: Cannot add header information - headers already sent by (output started at /home/leon/public_html/substitute/admin/adminphoto.php:56) in /home/leon/public_html/substitute/admin/adminphoto.php on line 72

jag har satt CHMOD till 777 på katalogen jag föröker köra upp till,

sen får jag ju det här med headers already sent.. det fattar jag inte riktigt vad det innebär?! skulle nån kunna förklara.

:birp 

```php
<?php require_once('../Connections/subconn.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}

$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "InsertPhoto")) {

########################################################
switch ($_FILES['file']['type']){
            case "image/gif":
                $fileext = ".gif";
            break;
            case $_FILES['file']['type']="image/jpeg" ||$_FILES['file']['type']="image/pjpeg":
                $fileext = ".jpg";
            break;
            case $_FILES['file']['type']="image/png" ||$_FILES['file']['type']="image/x-png":
                $fileext = ".jpg";
            break;
}

$i = 0;
$destinationfolder = "..\\PhotoArchive\\";
$destinationfile = "$SectionID-$i$fileext";

while (file_exists($destinationfolder.$destinationfile))
{
$i++;
}
copy($file, $destinationfolder.$destinationfile);

  $insertSQL = sprintf("INSERT INTO sphoto (SectionID, Name, Comments, Url) VALUES (%s, %s, %s, %s)",
                       GetSQLValueString($HTTP_POST_VARS['SectionID'], "int"),
                       GetSQLValueString($HTTP_POST_VARS['Name'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['Comments'], "text"),
                       GetSQLValueString($destinationfile, "text"));

  mysql_select_db($database_subconn, $subconn);
  $Result1 = mysql_query($insertSQL, $subconn) or die(mysql_error());

  $insertGoTo = "adminmenu.php";
  if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}

?>
```

Permalänk: https://www.webforum.nu/p/57942

## #2 — Web-Tor, 2002-11-04T11:37Z

Välkommen till wF Leon.
Det är alltid en bra ide att söka innan man postar sin fråga. Det här nog svar på din andra fråga: 

<http://www.webforum.nu/showthread.php?s=&threadid=56333>

Permalänk: https://www.webforum.nu/p/844193

---

Tråden på webben: https://www.webforum.nu/amne/php/57942-header-problem
