Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Apr 2010
    Messaggi
    343

    form invio mail con foto o logo

    Ciao a tutti,
    ho creato un form con relativo cod php , ma non capisco come mai mi invia tutti i dati ma non il file con il solito metodo sfoglia documento ecc ecc .. il file lo mette ma quando invia e ricevo la mail c'è tutto tranne il file in allegato .. vi posto lo script e il form chi mi aiuta a capire cosa manca ...

    Form:

    <form action="FormToEmail.php" method="post" enctype="multipart/form-data" name="inviaci_il_tuo_curriculum_di_chirurgia_gratu itamente">



    <label for="Nome"></label>

    <label for="Nome">Nome</label>
    <input type="text" name="Nome" id="Nome" />
    </p>



    <label for="Cognome">Cognome</label>
    <input type="text" name="Cognome" id="Cognome" />
    </p>



    <label for="Specializzazione">Specializzazione</label>
    <input type="text" name="Specializzazione" id="Specializzazione" />
    </p>



    <label for="E-mail">E-mail</label>
    <input type="text" name="E-mail" id="E-mail" />
    </p>



    <label for="Telefono">Telefono</label>
    <input type="text" name="Telefono" id="Telefono" />
    </p>



    <label for="Sito internet">Sito internet</label>
    <input type="text" name="Sito internet" id="Sito internet" />
    </p>



    <label for="Citta'">Citta'</label>
    <input type="text" name="Citta'" id="Citta'" />
    </p>



    <label for="Via">Via</label>
    <input type="text" name="Via" id="Via" />
    </p>



    <label for="Cap">Cap</label>
    <input type="text" name="Cap" id="Cap" />
    </p>



    <label for="Descrizione Operazioni">Descrizione OPerazioni</label>
    <textarea name="Descrizione Operazioni" id="Descrizione Operazioni" cols="45" rows="5"></textarea>
    </p>



    <label for="Curriculum">Curriculum</label>
    <textarea name="Curriculum" id="Curriculum" cols="45" rows="5"></textarea>
    </p>



    <label for="Visite specialistiche effettuate">Visite specialistiche effettuate</label>
    <input type="text" name="Visite specialistiche effettuate" id="Visite specialistiche effettuate" />
    </p>



    <label for="Autorizzo i dati per la Privacy">Autorizzo i dati per la Privacy</label>
    <select name="Autorizzo i dati per la Privacy" id="Autorizzo i dati per la Privacy">
    <option>si</option>
    <option>no</option>
    </select>
    </p>
    <h2>Nota: Se non si autorizzano i dati per la privacy non è possibile essere inserite nei portali</h2>
    <hr />



    <label for="Autorizzo il ricevimento di news letter">Autorizzo il ricevimento di news letter</label>
    <select name="Autorizzo il ricevimento di news letter" id="Autorizzo il ricevimento di news letter">
    <option>si</option>
    <option>no</option>
    </select>
    </p>



    <label for="Foto / Logo">Foto / Logo</label>
    <input type="file" name="Foto / Logo" id="Foto / Logo" />
    </p>



    <input type="hidden" name="hiddenField" id="hiddenField" />
    </p>


    Invia
    <input type="submit" name="Invia" id="Invia" value="Submit" />

    </p>
    </form>

    Pagina php:


    <?php

    $my_email = "info@miamail.com";

    /*

    Enter the continue link to offer the user after the form is sent. If you do not change this, your visitor will be given a continue link to your homepage.

    If you do change it, remove the "/" symbol below and replace with the name of the page to link to, eg: "mypage.htm" or "http://www.elsewhere.com/page.htm"

    */

    $continue = "http://www.miosito.com";

    /*

    Step 3:

    Save this file (FormToEmail.php) and upload it together with your webpage containing the form to your webspace. IMPORTANT - The file name is case sensitive! You must save it exactly as it is named above! Do not put this script in your cgi-bin directory (folder) it may not work from there.

    THAT'S IT, FINISHED!

    You do not need to make any changes below this line.

    */

    $errors = array();

    // Remove $_COOKIE elements from $_REQUEST.

    if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}}

    // Check all fields for an email header.

    function recursive_array_check_header($element_value)
    {

    global $set;

    if(!is_array($element_value)){if(preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc/i",$element_value)){$set = 1;}}
    else
    {

    foreach($element_value as $value){if($set){break;} recursive_array_check_header($value);}

    }

    }

    recursive_array_check_header($_REQUEST);

    if($set){$errors[] = "You cannot send an email header";}

    unset($set);

    // Validate email field.

    if(isset($_REQUEST['email']) && !empty($_REQUEST['email']))
    {

    if(preg_match("/(%0A|%0D|\n+|\r+|/i",$_REQUEST['email'])){$errors[] = "Email address may not contain a new line or a colon";}

    $_REQUEST['email'] = trim($_REQUEST['email']);

    if(substr_count($_REQUEST['email'],"@") != 1 || stristr($_REQUEST['email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $value){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}}

    }

    // Check referrer is from same site.

    if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}

    // Check for a blank form.

    function recursive_array_check_blank($element_value)
    {

    global $set;

    if(!is_array($element_value)){if(!empty($element_v alue)){$set = 1;}}
    else
    {

    foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);}

    }

    }

    recursive_array_check_blank($_REQUEST);

    if(!$set){$errors[] = "You cannot send a blank form";}

    unset($set);

    // Display any errors and exit if errors exist.

    if(count($errors)){foreach($errors as $value){print "$value
    ";} exit;}

    if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");}

    // Build message.

    function build_message($request_input){if(!isset($message_o utput)){$message_output ="";}if(!is_array($request_input)){$message_out put = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$ message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$mes sage_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");}

    $message = build_message($_REQUEST);

    $message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."";

    $message = stripslashes($message);

    $subject = "FormToEmail Comments";

    $headers = "From: " . $_REQUEST['email'];

    mail($my_email,$subject,$message,$headers);

    ?>


    Qualcuno mi sa dire cosa manca per allegare anche file e o foto !??!?!?

    grazie mille

  2. #2
    Utente di HTML.it
    Registrato dal
    Apr 2010
    Messaggi
    343

    please qualcuno sa che cosa manca per l'invio dell'allegato

    Please nessuno riesce a capire che cosa devo aggiungere per allegare il file ...

    le sto provando tutte ma non riesco a capire ... c'è qualche genio di php che puo' aiutarmi ad aggiungere questa benedetta stringa che mi allega il file .....


    Grazie a tutti

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.