téléchargement d'images - Forums de discussion

Navigation

Accueil du forum » PHP » téléchargement d'images


Le sujet

mojchristéléchargement d'images
Par mojchris, le Samedi 10/03/2007 à 12h38'36
91 messages
Bonjour,
J'ais installé une contribution sur un programme de boutique en ligne permettant à une personne d'envoyer une image mais le problème vient du fait que sur le mail que je reçoit, l'image n'apparait pas et même quand j'utilises psp pour l'ouvrir il me marque "fichier non déterminé".
La contrib utilises plusieurs fichiers mais 2 seulement gèrent l'envoi
upload_send.php
include("config.inc");
include("mailsend.inc");

$img_info = getimagesize($bild);

if ($bild) {
if ($img_info[2] == '2') {
$bildneu = "".$name."1.jpg";
} else {
include("error.php");
exit;
}
}


if ($bild) {
   copy($bild,$bildneu); // Kopiert das Bild
   $attachment = fread(fopen($bildneu, "r"), filesize($bildneu));
}



$header.="Kundenname: ".$name."\n\n";
$header.="Kundenmail: ".$email."\n\n";
$header.="Bestellnummer: ".$betreff."";

   $mail = new mime_mail();
   $mail->headers = "Message-ID: <$mail_from>";
   $mail->headers = "X-Mailer: PHP/".phpversion()."";
   $mail->headers = "X-Sender-IP: $REMOTE_ADDR";
   $mail->from = "$email";
   $mail->headers = "Errors-To: $mail_from";
   $mail->to = "$mail_from";
   $mail->subject = "Bildversand über Shopsystem";
   $mail->body = "$header";

   if ($bildneu) {
       if(eregi("(jpg)$",$bildneu)) {
       $mail->add_attachment("$attachment", $bildneu, "image/jpeg");
       }
   }
   
      

   $mail->send();
   @unlink($bildneu); // Löscht das temporäre Bild
   
            
include("ok.php");
?>

et mailsend.php

<?

  
class mime_mail
   
{
   var 
$parts;
   var 
$to;
   var 
$from;
   var 
$headers;
   var 
$subject;
   var 
$body;

   function 
mime_mail()
    {
    
$this->parts = array();
    
$this->to "";
    
$this->from "";
    
$this->subject "";
    
$this->body "";
    
$this->headers "";
    }

   function 
add_attachment($message$name ""$ctype "application/octet-stream")
    {
    
$this->parts[] = array (
                            
"ctype" => $ctype,
                            
"message" => $message,
                            
"encode" => $encode,
                            
"name" => $name
                            
);
    }

  function 
build_message($part)
   {
   
$message $part["message"];
   
$message chunk_split(base64_encode($message));
   
$encoding "base64";
   if (
$part["name"]!="") {
      
$dispstring "Content-Disposition: attachment; filename=\"$part[name]\"\n";
   }
   return 
"Content-Type: ".$part["ctype"].
                          (
$part["name"]?"; name = \"".$part["name"]."\"" "").
                          
"\nContent-Transfer-Encoding: $encoding\n".$dispstring."\n$message\n";
   }

  function 
build_multipart()
   {
   
$boundary "b".md5(uniqid(time()));
   
$multipart "Content-Type: multipart/mixed; boundary=$boundary\n\nThis is a MIME encoded message.\n\n--$boundary";

   for(
$i sizeof($this->parts)-1$i >= 0$i--)
      {
      
$multipart .= "\n".$this->build_message($this->parts[$i])."--$boundary";
      }
   return 
$multipart.= "--\n";
   }

  function 
send()
   {
   
$mime "";
   if (!empty(
$this->from))
      
$mime .= "From: ".$this->from."\n";
   if (!empty(
$this->headers))
      
$mime .= $this->headers."\n";

   if (!empty(
$this->body))
      
$this->add_attachment($this->body"""text/plain");
   
$mime .= "MIME-Version: 1.0\n".$this->build_multipart();
   
$success mail($this->to$this->subject""$mime);

   }
  };

?>

Je ne comprends pas d'ou peut venir le problème, si quelqu'un pouvait m'éclairer, cela m'aiderais beaucoup.
Merci d'avance

________________
mojchris

Les réponses

Aucune réponse pour le moment.

A lire également

- Les conditions générales d'utilisation du site

Top-sites membres

Dame Tortue | -11 pointsBlogHotel - Hébergement de Blog gratuit | -30 pointsMéta Annuaire | -39 pointsMon Coin de Jardin | -40 points

Discussions récentes dans les forums

Membres
Pseudo:
Pass: Mémoriser ?
Problème d'identificationInscription gratuite
Tribune libre
CNIL: 1098091
Connectés: 10
Google:
Publicité: Site de rencard sur internet, vous permettant de dialoguer et pourquoi pas de faire une rencontre intéressante.