Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/02/2004, 05:55
pansho
 
Fecha de Ingreso: septiembre-2003
Ubicación: Hondarribia
Mensajes: 32
Antigüedad: 20 años, 7 meses
Puntos: 0
Upload y funcion mail

Hola a todos, espero que todo bien...

Tengo un applet que sube archivos al servidor, pero lo que yo quiero es que vayan a un e-mail.

El script que sube al servidor los archivos es este

Código PHP:
<?php

/*
 * JUpload php example
 * saves all uploaded files to the temp/ directory
 * see <a href="/out.php?http%3A%2F%2Fwww.haller-systemservice.net%2Fjupload%2F" target="_blank">[url]http://www.haller-systemservice.net/jupload/[/url]</a>
 * info@@haller-systemservice.net
  *´
 */

/*
 * Iterate over all received files.
 * PHP > 4.2 / 4.3 ? will save the file information into the
 * array $_FILES[]. Before these versions, the data was saved into
 * $HTTP_POST_FILES[]
 */
foreach($_FILES as $tagname=>$objekt)
{
 
// get the temporary name (e.g. /tmp/php34634.tmp)
 
$tempName $objekt['tmp_name'];
 
 
// get the real filename
 
$realName $objekt['name'];
 
 
// where to save the file?
 
$target './temp/' $realName;
 
 
// print something to the user
 
echo "<br>Processing file $realName...\n";
 
flush();
 
 
// move the file to the target directory
 
move_uploaded_file($tempName,$target);

    
/* This is a sample from Wilson
     * which will generate thumbnails from
     * the uploaded files. Use it, if you like.
     */
    /*
     $src_img = imagecreatefromjpeg($target);
     $origw=imagesx($src_img); 
     $origh=imagesy($src_img); 
     $new_w = '150';
     $ratio=$origh*$new_w; 
     $new_h=$ratio/$origw; 
     $dst_img = imagecreatetruecolor($new_w,$new_h); 
      imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx
    ($src_img),imagesy($src_img)); 
     imagejpeg($dst_img, $thumb_target); 
    */

 // end of iteration
 
echo "next file...\n";
 
flush();
}


/*
 * This is optional.
 * send error response to jupload
 * format depends on API version of PHP
 */
switch(php_sapi_name())
{
 case 
'cgi':
 case 
'cgi-fcgi':
  
$sz_htstatus 'Status: ';
  break;
 default:
  
$sz_htstatus 'HTTP/1.0: ';
  break;
}

/*
 * Let's generate an error message for JUpload
 */
 
// everything is okay - default message
$sz_message='200 JUpload works great';

// if we got no files, show error message to user
if (count($_FILES) == 0
 
$sz_message='406 No files uploaded';

// now, send the header to JUpload applet
header($sz_htstatus.$sz_message);

// print debug code
//echo "<br><pre>_FILES:\n";
//print_r($_FILES);
//echo "</pre>\n";
flush();

?>
Yo he probado con esto,
Código PHP:
  // move the file to the target directory
mail ("[email protected]"$tempName$realName); 
pero sólo me llega un e-mail con el nombre del archivo y el tempName como subject. Lo más importante, el propio archivo, no me llega.

He probado también
Código PHP:
  // move the file to the target directory
mail ("[email protected]"$tempName$realName$_FILES); 
pero no funciona

Gracias de antemano. Es pero algún día poder aportar algo en vez de preguntar tanto.