Sólo un apunte, ya hay clases AS3 para hacer el envío de mails directamente desde Flash y sin nada más:
http://www.bytearray.org/?p=27 Sólo player 9, claro. Salud! On 11/28/06, Fede Rivas <[EMAIL PROTECTED]> wrote: > Totalmente de acuerdo. Para evitar el problema de concurrencia de nombres, > genera un nombre único. Y ya para rematar, cuando envies el email, borras el > fichero del temporal ;) > > > El 28/11/06 19:34, "Julio Rabadán González" <[EMAIL PROTECTED]> escribió: > > > Ferran Rosales escribió: > >> > >> > >> Hola! > >> > >> Necesito hacer un formulario que envie un mail con los datos del usuario y > >> una foto que el usuario coge desde su ordenador. Se con php se puede, pero > >> ahi me pierdo mucho...alguien puede ayudarme. > >> > >> > >> Gracias. > >> > >> Ferran. > >> _________________________________________________________________ > >> Consigue el nuevo Windows Live Messenger > >> http://get.live.com/messenger/overview > >> ----------------------------------------------------- > >> ASNativos > >> www.5dms.com > >> subscripciones/desubscripciones > >> http://asnativos.5dms.com > >> ----------------------------------------------------- > >> > >> > >> > > Lo que puedes hacer es lo siguiente. Suponiendo que tienes un formulario > > en flash ya relleno, y que con el objeto FileReference ya has > > seleccionado el fichero que quieres adjuntar, cuando envíes la > > información al servidor lo harás en dos pasos. Primero subes el fichero > > al servidor como cualquier fichero que subas con FileReference, y lo > > guardas en una carpeta temporal (tmp_upload). Cuando salte el evento > > FileReference.onComplete llamas a un php al que le pasas los otros datos > > del formulario, y el nombre del fichero. Este script PHP enviará correo > > con fichero adjunto, el fichero a adjuntar de la carpeta temporal donde > > se ha almacenado. Listo. > > > > El PHP para enviar mail es este: > > > > <code> > > > > <?php > > $fileatt = "./tmp_upload/". $_REQUEST['cv']; // Path to the > > file > > $fileatt_type = "application/octet-stream"; // File Type > > $fileatt_name = $_REQUEST['cv']; // Filename that will be used for the > > file as the attachment > > > > $nombre = $_REQUEST['nombre']; > > $tlf1= $_REQUEST['telefono1']; > > $tlf2= $_REQUEST['telefono2']; > > $correo = $_REQUEST['email']; > > $referencia = $_REQUEST['referencia']; > > > > $email_from = "[EMAIL PROTECTED]"; // Who the email is from > > $email_subject = "Asunto"; // The Subject of the email > > $email_txt = " Mail con referencia: $referencia<br> > > <b>Nombre:</b> $nombre<br> > > <b>Telefono 1:</b> $tlf1<br> > > <b>Telefono 2:</b> $tlf2<br> > > <b>Email:</b> $correo"; // Message that the email has in it > > > > $email_to = "[EMAIL PROTECTED]"; // Who the email is too > > > > $headers = "From: ".$email_from; > > > > $file = fopen($fileatt,'rb'); > > $data = fread($file,filesize($fileatt)); > > fclose($file); > > > > $semi_rand = md5(time()); > > $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; > > > > $headers .= "\nMIME-Version: 1.0\n" . > > "Content-Type: multipart/mixed;\n" . > > " boundary=\"{$mime_boundary}\""; > > > > $email_message .= "This is a multi-part message in MIME format.\n\n" . > > "--{$mime_boundary}\n" . > > "Content-Type:text/html; charset=\"UTF-8\"\n" . > > "Content-Transfer-Encoding: 7bit\n\n" . > > $email_txt . "\n\n" ; > > > > $data = chunk_split(base64_encode($data)); > > > > $email_message .= "--{$mime_boundary}\n" . > > "Content-Type: {$fileatt_type};\n" . > > " name=\"{$fileatt_name}\"\n" . > > //"Content-Disposition: attachment;\n" . > > //" filename=\"{$fileatt_name}\"\n" . > > "Content-Transfer-Encoding: base64\n\n" . > > $data . "\n\n" . > > "--{$mime_boundary}--\n"; > > > > $ok = @mail($email_to, $email_subject, $email_message, $headers); > > > > if($ok) { > > echo "&mail=si"; > > unlink($fileatt); > > } else { > > die("Sorry but the email could not be sent. Please go back and try > > again!"); > > } > > ?> > > > > </code> > > > > El fichero que recibe el fichero del FileReference podría ser este : > > > > <code> > > > > <?php > > > > foreach($_FILES as $nombre=>$fichero) > > { > > if(is_uploaded_file($fichero['tmp_name'])) > > { > > move_uploaded_file($fichero['tmp_name'],"./tmp_upload/" . > > $fichero['name']); > > > > echo "Fichero copiado en ". realpath ("./tmp_upload/") . > > $fichero['name']; > > } > > } > > ?> > > </code> > > > > Puedes tener problemasde concurrencia si dos personas deciden subir a la > > vez un fichero con el mismo nombre. Para evitar eso puedes cambiar el > > nombre por uno temporal, y meter el nombre temporal en una variable de > > sesión. El script de envío leera de la sesion el nombre del fichero > > temporal, y lo adjuntará, pero utilizando el nombre que se le pasa como > > variable. > > > > > > Espero que sea de utilidad. > > > > Un saludo > > > > EvolvE > > > > ----------------------------------------------------- > > ASNativos > > www.5dms.com > > subscripciones/desubscripciones > > http://asnativos.5dms.com > > ----------------------------------------------------- > > > > > > ----------------------------------------------------- > ASNativos > www.5dms.com > subscripciones/desubscripciones > http://asnativos.5dms.com > ----------------------------------------------------- > -- Juan Delgado - Zárate http://zarate.tv http://dandolachapa.com ----------------------------------------------------- ASNativos www.5dms.com subscripciones/desubscripciones http://asnativos.5dms.com -----------------------------------------------------

