Page 1 of 1

Using Header in IE 6 PC and uploading files...

Posted: Thu Nov 24, 2005 1:55 pm
by bertrand
Hi

I'd like to know if anyone ever experienced any problems regarding using the header function under IE 6 PC "AND" using a function to upload a file? I am mentionning IE 6 PC because it's the ONLY browser that this happens. FF Mac/PC and Safari Mac works fine...

Because the only pages that doesn't work are the ones with an upload function, the other that interact with the DB works just fine.

Here's my upload function. Tell me if it's too long, I'll edit my post:

function televerserFichier($strNomChampsImage, $strCheminStockagePhoto, $strCheminStockageVignette, $strNouveauNomPhoto,$intLargeurMaxPhoto,$intHauteurMaxPhoto,$blnCreerVignette,$intNbDivision)
{
// si le code d'erreur = 0 (false) c'est que le fichier a été correctement téléversé
// dans le répertoire par défaut défini dans le fichier php.ini (upload_tmp_dir)
$blnValide = true;
$aTableauGrandeur = getimagesize($_FILES[$strNomChampsImage]['tmp_name']);
if(!$_FILES[$strNomChampsImage]['error'])
{
// alors, on doit vérifier le dossier de destination
error_reporting(E_ALL ^ E_NOTICE);
$repertoireDestination = $_SERVER['DOCUMENT_ROOT'].$strCheminStockagePhoto;
// validation de la grandeur de l'image à uploader selon les paramètres reçus
if ($aTableauGrandeur[1] > $intHauteurMaxPhoto)
{
$blnValide = false;
$msgErreurPhoto="L'image envoyée est trop haute.";
return $msgErreurPhoto;
}

if ($aTableauGrandeur[0] > $intLargeurMaxPhoto)
{
$msgErreurPhoto="L'image envoyée est trop large.";
return $msgErreurPhoto;
$blnValide = false;
}

if ($blnValide == true)
{
if ($blnCreerVignette == 1)
{
televerserFichierVignette($strNomChampsImage,$strCheminStockageVignette,$strNouveauNomPhoto,$intNbDivision);
}

// la condition suivante vérifie si le répertoire de destination existe et a une permission d'écriture
if(is_dir($repertoireDestination) && is_writable($repertoireDestination))
{
// la variable suivante concatène le répertoire de destination et le nom actuel du fichier
$nomFichierFinal=$repertoireDestination."/".$strNouveauNomPhoto;

if(@copy($_FILES[$strNomChampsImage]["tmp_name"],$nomFichierFinal))
{
// si la copie est réussie on retourne le chemin et nom du fichier final
$msgErreurPhoto="Image en chargement";
return $msgErreurPhoto;
}
else
{
$msgErreurPhoto="La copie de l'image a échouée";
return $msgErreurPhoto;
}
}
else
{
// validation de quelle condition non respectée
if(is_dir($repertoireDestination))
{
$msgErreurPhoto1= "true";
}
else
{
$msgErreurPhoto1 = "Le répertoire de destination n'existe pas. (".$repertoireDestination.")";
};

if(is_writable($repertoireDestination))
{
$msgErreurPhoto2 = "true";
}
else
{
$msgErreurPhoto2 = "Le répertoire n'a pas de permission d'écriture. (".$repertoireDestination.")";
};

return $msgErreurPhoto;
}
}
}
else
{
if ($_FILES[$strNomChampsImage]['error'] != 4)
{
$msgErreurPhoto="Le fichier d'image ne s'est pas correctement téléchargé.";
return $msgErreurPhoto;
}
else
{
$msgErreurPhoto="Le chemin d'accès n'a pas été écrit.";
return $msgErreurPhoto;
}
}
};

Thanks a lot for this website btw...