Autor Zpráva
rad
Profil *
uz si s tim nevim rady nevim kde delam chybu
na server se nic neuploduje - vyhazuje mi to chyby
Warning: imagecreatefromjpeg(../images/img25.jpg) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in /data/web/virtuals//virtual/www/test/admin/produit.php on line 107


$i=0;
for($i=0;$i < count($_FILES['upload']['name']);$i++)
{
   if($_FILES['upload']['size'][$i] === 0 || empty($_FILES['upload']['tmp_name'][$i]))
{
    $message.="<p class=\"error\">error upload.</p>\r\n";    
} 
else if($_FILES['upload']['size'][$i] > 30000000) 
{   
    $message.="<p class=\"error\">error BIG.</p>\r\n";
}
 else if (!preg_match('/[.](gif|jpg|jpeg|png|JPG|JPEG)$/',$_FILES['upload']['name'][$i]))     //error pour type   
    {
    $message.='<p class="error">type de fichier non reconnu</p>';             
    }
else if($_FILES['upload']['error'][$i] !== UPLOAD_ERR_OK) 
{    
     $message.="<p class=\"error\">PHP error.</p>\r\n";
}   

else{
      
$db->query("SELECT id_photo_produit FROM photo_produit ORDER BY id_photo_produit DESC LIMIT 1;");
//derniere numero

while($result=$db->fetch_assoc())       
   {      
   $pl=$result['id_photo_produit'];
   };    
   $pl=$pl+1;
    
     if(!preg_match('/[.](gif|jpg|jpeg|png|JPG|JPEG)$/',$_FILES['upload']['name'][$i]))     //error pour type   JPG et jpg ... je pense on peux faire mieux
    {
        $message.='<p class="error">type de fichier non reconnu</p>';             
    }
    
    else {
    
    if (preg_match('/[.](jpg|JPG)$/',$_FILES['upload']['name'][$i] )) {   
           //renome
         $image="img".$pl.".jpg";
         
    } else if (preg_match('/[.](gif)$/', $_FILES['upload']['name'][$i])) {  
         $image="img".$pl.".gif";  
         
    } else if (preg_match('/[.](png)$/', $_FILES['upload']['name'][$i])) {  
          $image="img".$pl.".png";    
    }
      else if (preg_match('/[.](jpeg|JPEG)$/', $_FILES['upload']['name'][$i])) {  
          $image="img".$pl.".jpeg";    
    }
           
  $filename = $image;
    
  $source = $_FILES['userfile']['tmp_name'][$i];  
  
  $target = $path_to_image_directory . $filename; 
  

  
    move_uploaded_file($source, $target);  
 
    
     if(preg_match('/[.](jpg)$/', $filename)) {  
        $im = imagecreatefromjpeg($path_to_image_directory . $filename);  
    } else if (preg_match('/[.](gif)$/', $filename)) {  
        $im = imagecreatefromgif($path_to_image_directory . $filename);  
    } else if (preg_match('/[.](png)$/', $filename)) {  
        $im = imagecreatefrompng($path_to_image_directory . $filename);  
    }  
    
    $ox = imagesx($im);  
    $oy = imagesy($im);  
		 
    if  (($ox<800)&&($oy<800))
    {
    		imagedestroy($im);  
    }	  
	  else{                     		
		if($ox>$oy){
		   $nx=800;
		   $ny=($nx*$oy)/$ox;
		}
		else{
		     $ny=800;
		     $nx=($ny*$ox)/$oy;
		}		        
    $nm = imagecreatetruecolor($nx, $ny);    
    imagecopyresized($nm, $im, 0,0,0,0,$nx,$ny,$ox,$oy);  
    imagejpeg($nm, $target, 100);    
    imagedestroy($nm);
    }            
	  	  

$db->query("INSERT INTO photo_produit VALUES ('','$image','$description','$id_produit');");
}
}	
okolojdouci
Profil *
rad:
No such file or directory in /data/web/virtuals//virtual/www/test/admin/produit.php on line 107

Škoda, že 107 je víc než 97.
rad
Profil *
ted mi to vyhazuje hlasky
Warning: move_uploaded_file(../images/img26.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /data/web/virtuals/4819/virtual/www/test/admin/produit.php on line 105

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/data/web/virtuals/4819/virtual/tmp/phpd77FlY' to '../images/img26.jpg' in /data/web/virtuals/4819/virtual/www/test/admin/produit.php on line 105

Warning: imagecreatefromjpeg(../images/img26.jpg) [function.imagecreatefromjpeg]: failed to open stream: Permission denied in /data/web/virtuals/4819/virtual/www/test/admin/produit.php on line 109
okolojdouci
Profil *
rad:

Funkce move_uploaded_file není v uvedeném kódu pro jistotu vůbec.
Tam kam se snažíš nahrávat, není povolen přístup. Otevři si to ftp klientem a nastav tam 777.
rad
Profil *
je to radek move_uploaded_file($source, $target); 61 ale to uz je jedno diky bylo pristupem nevim proc jsem si lamal hlavu
diky

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm: