PSD-Tutorials.de
Forum für Design, Fotografie & Bildbearbeitung
Tutkit
Agentur
Hilfe
Kontakt
Start
Forum
Aktuelles
Besonderer Inhalt
Foren durchsuchen
Tutorials
News
Anmelden
Kostenlos registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Menü
Anmelden
Kostenlos registrieren
App installieren
Installieren
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Antworten auf deine Fragen:
Neues Thema erstellen
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
Formular mit Uploadfunktion
Beitrag
<blockquote data-quote="cmfa" data-source="post: 2469967" data-attributes="member: 425753"><p>Hallo Freunde der Nacht,</p><p></p><p>meine Tochter soll in der Schule eine HP basteln. Soweit so gut. Darin enthalten soll ein Formular mit Uploadfunktion sein. Ich habe eines im Netz gefunden und es läuft auch so weit. Jedoch einen kleinen Fehler hat es. </p><p>Die hochgeladene Datei kommt per E-Mail Anhang + einer "unbekannte Anlage 0000.txt" die leer ist. Jedoch der Inhalt aus den Formularfeldern ist weg. Wenn kein File hochgeladen wird kommt der Inhalt der Formularfelder an. Ich habe schon eine ganze Weile gesucht jedoch ohne den Fehler zu finden. Vielleicht habt Ihr ja eine Idee wo der Fehler liegt.</p><p></p><p> VG CMFA</p><p></p><p>Aufruf:</p><p>[php]<?PHP session_start(); ?></p><p></p><p><?php</p><p>include_once("kontaktformular.php");</p><p>echo kontaktformular_fileupload(array("Mali@home.de"),"Onlinenachricht mit Datei Anhang","form2");</p><p>?>[/php]</p><p></p><p>Datei:</p><p>[php]if(!function_exists("kontaktformular_fileupload")){</p><p>function kontaktformular_fileupload($empf,$formname,$formid="cformup320",$pfad=""){</p><p>global $_POST,$_SESSION;</p><p></p><p>$allowed_endings = array('jpg','pdf','zip','rar'); // Array mit allen erlaubten Dateiendungen:</p><p>$allowed_filesize = 5242880; // Max. Dateigröße in Byte</p><p></p><p>$return = "";</p><p>$error = FALSE;</p><p></p><p>if(isset($formid) && !empty($formid)){</p><p> $data['Anrede'] = $_POST['anrede_'.$formid];</p><p> $data['name'] = $_POST['name_'.$formid];</p><p> $data['strnr'] = $_POST['strnr_'.$formid];</p><p> $data['plzort'] = $_POST['plzort_'.$formid];</p><p> $data['tel'] = $_POST['tel_'.$formid];</p><p> $data['email'] = $_POST['email_'.$formid];</p><p> $data['nachricht'] = $_POST['nachricht_'.$formid];</p><p> $data['captcha'] = $_POST['captcha_'.$formid];</p><p></p><p> $error = TRUE;</p><p></p><p> // Für Versand aus Empfänger-Adresse auf jeden Fall einen Array machen:</p><p> if(!is_array($empf))</p><p> $empf = array($empf);</p><p></p><p> if(isset($_POST['name_'.$formid]) && !empty($_POST['name_'.$formid]) &&</p><p> isset($_POST['anrede_'.$formid]) && !empty($_POST['anrede_'.$formid]) &&</p><p> isset($_POST['email_'.$formid]) && !empty($_POST['email_'.$formid]) && check_mail($_POST['email_'.$formid]) &&</p><p> isset($_POST['nachricht_'.$formid]) && !empty($_POST['nachricht_'.$formid]) &&</p><p> isset($_POST['captcha_'.$formid]) && !empty($_POST['captcha_'.$formid]) && md5($_POST['captcha_'.$formid]) == $_SESSION['antispam_'.$formid])</p><p> {</p><p></p><p> $error = FALSE;</p><p></p><p> $absender = preg_replace( "/[^a-z0-9 !?:;,.\/_\-=+@#$&\*\(\)]/im", "",$_POST['email_'.$formid]);</p><p> $absender = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "",$absender);</p><p> </p><p> $anrede = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "",$_POST['anrede_'.$formid]);</p><p> $name = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "",$_POST['name_'.$formid]);</p><p> $str = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "",$_POST['strnr_'.$formid]);</p><p> $plz = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "",$_POST['plzort_'.$formid]);</p><p> $tel = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "",$_POST['tel_'.$formid]);</p><p> $txt = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "",$_POST['nachricht_'.$formid]);</p><p> $mail_header = "From:".$name."<".$absender.">";</p><p></p><p> $mail_content = "Anrede: ".$anrede."</p><p>Name: ".$name."</p><p>Strasse Hausnummer: ".$str."</p><p>PLZ Ort: ".$plz."</p><p>Telefon: ".$tel."</p><p>E-Mail: ".$absender."</p><p>IP-Adresse: ".$_SERVER['REMOTE_ADDR']."</p><p></p><p>Nachricht:</p><p>".$txt."";</p><p></p><p> // Datei-Anhang verarbeiten</p><p> if(isset($_FILES['file_'.$formid]['name']) && $_FILES['file_'.$formid]['name'] != ""){</p><p> $split = pathinfo($_FILES['file_'.$formid]['name']);</p><p> $filename = $split['filename'];</p><p> $fileType = $split['extension'];</p><p> </p><p> // Erlaubte Endungen / Dateigröße überprüfen</p><p> if(in_array($fileType,$allowed_endings) && $_FILES['file_'.$formid]['size'] <= $allowed_filesize){</p><p> $boundary = strtoupper(md5(uniqid(time())));</p><p></p><p> $mail_header .= "\nMIME-Version: 1.0"."";</p><p> $mail_header .= "\nContent-Type: multipart/mixed; boundary=\"".$boundary."\"";</p><p></p><p> $mail_body = "\nMIME-Version: 1.0"."";</p><p> $mail_body .= "\nContent-Type: multipart/mixed; boundary=\"".$boundary."\"";</p><p> $mail_body .= "\n\nThis is a multi-part message in MIME format -- Dies ist eine mehrteilige Nachricht im MIME-Format";</p><p></p><p> // "Normalen" Text-Inhalt einfügen:</p><p> $mail_body .= "\n--".$boundary."";</p><p> $mail_body .= "\nContent-Type: text/plain";</p><p> $mail_body .= "\nContent-Transfer-Encoding: 8bit\n";</p><p> $mail_body .= $mail_content;</p><p> $mail_body .= "\n--".$boundary."";</p><p> echo $mail_content;</p><p> $file_content = fread(fopen($_FILES['file_'.$formid]['tmp_name'],"r"),$_FILES['file_'.$formid]['size']);</p><p> $file_content = chunk_split(base64_encode($file_content));</p><p></p><p> $mail_body .= "\nContent-Type: ".mime_content_type($_FILES['file_'.$formid]['name'])."; name=\"".stripslashes($_FILES['file_'.$formid]['name'])."\"";</p><p> $mail_body .= "\nContent-Transfer-Encoding: base64";</p><p> $mail_body .= "\nContent-Disposition: attachment; filename=\"".stripslashes($_FILES['file_'.$formid]['name'])."\"";</p><p> $mail_body .= "\n\n".$file_content."";</p><p> $mail_body .= "\n--".$boundary."";</p><p> echo $mail_content;</p><p> }</p><p> else</p><p> $error = TRUE;</p><p> }</p><p> // Wenn kein Datei-Anhang ausgewählt wurde</p><p> else{</p><p> $mail_body = $mail_content;</p><p> //echo $mail_content;</p><p> }</p><p></p><p> foreach($empf as $empf_mail){</p><p> //echo $mail_header."<br /><hr><br />".$mail_body;</p><p> mail($empf_mail,$formname,$mail_body,$mail_header);</p><p> }</p><p></p><p> $return .= "<br /><p style=\"border: 1px solid green; padding: 5px;\"></p><p> <b>Ihre Bewerbung wurde erfolgreich verschickt und wird so schnell wie m&ouml;glich bearbeitet.</b></p>";</p><p> }</p><p></p><p> if(isset($_POST['submit_'.$formid]) && !empty($_POST['submit_'.$formid]) && $error){</p><p> $return .= "<br /><p style=\"border: 1px solid red; padding: 5px;\"></p><p> Sie haben nicht alle ben&ouml;tigen Felder (*) ausgef&uuml;llt oder den Spamschutzcode nicht richtig eingegeben.</p>";</p><p> }</p><p> }</p><p>else $formid = rand_String(12);</p><p> /*value=\"".$data['anrede']."\"*/</p><p>$return .= "</p><p><form enctype=\"multipart/form-data\" action=\"".$_SERVER['PHP_SELF']."\" method=\"post\"></p><p><table cellpadding=\"0\" cellspacing=\"5\" class=\"formtab pluginwidth\"></p><p></p><p> <tr></p><p> <td>Anrede *</td></p><p> <td></p><p> <select name=\"anrede_".$formid."\" style=\"width: 150px; \"></p><p> <option> </option></p><p> <option>Herr</option></p><p> <option>Frau</option></p><p> </select></td></p><p> </tr></p><p></p><p> <tr></p><p> <td>Vor- u. Nachname *</td></p><p> <td><input class=\"tx\" type=\"text\" name=\"name_".$formid."\" value=\"".$data['name']."\" style=\"width: 150px; \" /></td></p><p> </tr></p><p> <tr></p><p> <td>Strasse u. Hausnummer *</td></p><p> <td><input class=\"tx\" type=\"text\" name=\"strnr_".$formid."\" value=\"".$data['strnr']."\" style=\"width: 150px; \" /></td></p><p> </tr></p><p> <tr></p><p> <td>PLZ u. Ort</td></p><p> <td><input class=\"tx\" type=\"text\" name=\"plzort_".$formid."\" value=\"".$data['plzort']."\" style=\"width: 150px; \" /></td></p><p> </tr></p><p></p><p> <tr></p><p> <td>Telefon</td></p><p> <td><input class=\"tx\" type=\"text\" name=\"tel_".$formid."\" value=\"".$data['tel']."\" style=\"width: 150px; \" /></td></p><p> </tr></p><p></p><p> <tr></p><p> <td>E-Mail *</td></p><p> <td><input class=\"tx\" type=\"text\" name=\"email_".$formid."\" value=\"".$data['email']."\" style=\"width: 150px; \" /></td></p><p> </tr></p><p></p><p> <tr></p><p> <td>Datei max. 5 MB</td></p><p> <td><input type=\"file\" name=\"file_".$formid."\" /></td></p><p> </tr></p><p></p><p> <tr></p><p> <td valign=\"top\">Nachricht *</td></p><p> <td><textarea class=\"tx\" name=\"nachricht_".$formid."\">".$data['nachricht']."</textarea></td></p><p> </tr></p><p></p><p> <!--captcha--></p><p> <tr></p><p> <td>Sicherheitscode</td></p><p> <td><img src=\"".$pfad."secimg.php?formid=".$formid."\" alt=\"Sicherheitscode (Spamschutz)\" title=\"Sicherheitscode: Anti-Spam-System\" width=\"90\" height=\"30\" /></td></p><p> </tr></p><p> <tr></p><p> <td>Sicherheitscode eingeben *</td></p><p> <td></p><p> <input type=\"text\" class=\"tx\" name=\"captcha_".$formid."\" maxlength=\"6\" style=\"width: 150px; \" /></p><p> </td></p><p> </tr></p><p></p><p> <input type=\"hidden\" name=\"formid\" value=\"".$formid."\" /></p><p> <tr></p><p> <td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"submit_".$formid."\" value=\"Absenden\" /></td></p><p> </tr></p><p></table></p><p></form>";</p><p></p><p>return $return;</p><p></p><p>}</p><p>}</p><p></p><p>if(!function_exists("rand_String")){</p><p>function rand_String($laenge){</p><p> mt_srand((double)microtime()*1000000);</p><p> $zahl = mt_rand(1000, 9999);</p><p></p><p> $passzahl = md5($zahl);</p><p> $newpass = substr($passzahl,0,$laenge);</p><p></p><p> return $newpass;</p><p> }</p><p>}</p><p></p><p>if(!function_exists("check_mail")){</p><p>function check_mail($email){</p><p> if(filter_var($email, FILTER_VALIDATE_EMAIL)) return TRUE;</p><p> else return FALSE;</p><p>}</p><p>}</p><p></p><p>// Mime-Typen von Dateien bestimmen</p><p>/*$filename Dateiname zu dem der Dateityp bestimmt werden soll</p><p> </p><p>RETURN: Mime-Typ</p><p> */</p><p>if(!function_exists('mime_content_type')) {</p><p>function mime_content_type($filename) {</p><p></p><p> $mime_types = array(</p><p> 'txt' => 'text/plain',</p><p> 'htm' => 'text/html',</p><p> 'html' => 'text/html',</p><p> 'php' => 'text/html',</p><p> 'css' => 'text/css',</p><p> 'js' => 'application/javascript',</p><p> 'json' => 'application/json',</p><p> 'xml' => 'application/xml',</p><p> 'swf' => 'application/x-shockwave-flash',</p><p> 'flv' => 'video/x-flv',</p><p></p><p> // images</p><p> 'png' => 'image/png',</p><p> 'jpe' => 'image/jpeg',</p><p> 'jpeg' => 'image/jpeg',</p><p> 'jpg' => 'image/jpeg',</p><p> 'gif' => 'image/gif',</p><p> 'bmp' => 'image/bmp',</p><p> 'ico' => 'image/vnd.microsoft.icon',</p><p> 'tiff' => 'image/tiff',</p><p> 'tif' => 'image/tiff',</p><p> 'svg' => 'image/svg+xml',</p><p> 'svgz' => 'image/svg+xml',</p><p></p><p> // archives</p><p> 'zip' => 'application/zip',</p><p> 'rar' => 'application/x-rar-compressed',</p><p> 'exe' => 'application/x-msdownload',</p><p> 'msi' => 'application/x-msdownload',</p><p> 'cab' => 'application/vnd.ms-cab-compressed',</p><p></p><p> // audio/video</p><p> 'mp3' => 'audio/mpeg',</p><p> 'qt' => 'video/quicktime',</p><p> 'mov' => 'video/quicktime',</p><p></p><p> // adobe</p><p> 'pdf' => 'application/pdf',</p><p> 'psd' => 'image/vnd.adobe.photoshop',</p><p> 'ai' => 'application/postscript',</p><p> 'eps' => 'application/postscript',</p><p> 'ps' => 'application/postscript',</p><p></p><p> // ms office</p><p> 'doc' => 'application/msword',</p><p> 'rtf' => 'application/rtf',</p><p> 'xls' => 'application/vnd.ms-excel',</p><p> 'ppt' => 'application/vnd.ms-powerpoint',</p><p></p><p> // open office</p><p> 'odt' => 'application/vnd.oasis.opendocument.text',</p><p> 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',</p><p> );</p><p></p><p> $ext = strtolower(array_pop(explode('.',$filename)));</p><p> if (array_key_exists($ext, $mime_types)) {</p><p> return $mime_types[$ext];</p><p> }</p><p> elseif (function_exists('finfo_open')) {</p><p> $finfo = finfo_open(FILEINFO_MIME);</p><p> $mimetype = finfo_file($finfo, $filename);</p><p> finfo_close($finfo);</p><p> return $mimetype;</p><p> }</p><p> else</p><p> return 'application/octet-stream';</p><p></p><p>}</p><p>}[/php]</p></blockquote><p></p>
[QUOTE="cmfa, post: 2469967, member: 425753"] Hallo Freunde der Nacht, meine Tochter soll in der Schule eine HP basteln. Soweit so gut. Darin enthalten soll ein Formular mit Uploadfunktion sein. Ich habe eines im Netz gefunden und es läuft auch so weit. Jedoch einen kleinen Fehler hat es. Die hochgeladene Datei kommt per E-Mail Anhang + einer "unbekannte Anlage 0000.txt" die leer ist. Jedoch der Inhalt aus den Formularfeldern ist weg. Wenn kein File hochgeladen wird kommt der Inhalt der Formularfelder an. Ich habe schon eine ganze Weile gesucht jedoch ohne den Fehler zu finden. Vielleicht habt Ihr ja eine Idee wo der Fehler liegt. VG CMFA Aufruf: [php]<?PHP session_start(); ?> <?php include_once("kontaktformular.php"); echo kontaktformular_fileupload(array("Mali@home.de"),"Onlinenachricht mit Datei Anhang","form2"); ?>[/php] Datei: [php]if(!function_exists("kontaktformular_fileupload")){ function kontaktformular_fileupload($empf,$formname,$formid="cformup320",$pfad=""){ global $_POST,$_SESSION; $allowed_endings = array('jpg','pdf','zip','rar'); // Array mit allen erlaubten Dateiendungen: $allowed_filesize = 5242880; // Max. Dateigröße in Byte $return = ""; $error = FALSE; if(isset($formid) && !empty($formid)){ $data['Anrede'] = $_POST['anrede_'.$formid]; $data['name'] = $_POST['name_'.$formid]; $data['strnr'] = $_POST['strnr_'.$formid]; $data['plzort'] = $_POST['plzort_'.$formid]; $data['tel'] = $_POST['tel_'.$formid]; $data['email'] = $_POST['email_'.$formid]; $data['nachricht'] = $_POST['nachricht_'.$formid]; $data['captcha'] = $_POST['captcha_'.$formid]; $error = TRUE; // Für Versand aus Empfänger-Adresse auf jeden Fall einen Array machen: if(!is_array($empf)) $empf = array($empf); if(isset($_POST['name_'.$formid]) && !empty($_POST['name_'.$formid]) && isset($_POST['anrede_'.$formid]) && !empty($_POST['anrede_'.$formid]) && isset($_POST['email_'.$formid]) && !empty($_POST['email_'.$formid]) && check_mail($_POST['email_'.$formid]) && isset($_POST['nachricht_'.$formid]) && !empty($_POST['nachricht_'.$formid]) && isset($_POST['captcha_'.$formid]) && !empty($_POST['captcha_'.$formid]) && md5($_POST['captcha_'.$formid]) == $_SESSION['antispam_'.$formid]) { $error = FALSE; $absender = preg_replace( "/[^a-z0-9 !?:;,.\/_\-=+@#$&\*\(\)]/im", "",$_POST['email_'.$formid]); $absender = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "",$absender); $anrede = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "",$_POST['anrede_'.$formid]); $name = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "",$_POST['name_'.$formid]); $str = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "",$_POST['strnr_'.$formid]); $plz = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "",$_POST['plzort_'.$formid]); $tel = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "",$_POST['tel_'.$formid]); $txt = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "",$_POST['nachricht_'.$formid]); $mail_header = "From:".$name."<".$absender.">"; $mail_content = "Anrede: ".$anrede." Name: ".$name." Strasse Hausnummer: ".$str." PLZ Ort: ".$plz." Telefon: ".$tel." E-Mail: ".$absender." IP-Adresse: ".$_SERVER['REMOTE_ADDR']." Nachricht: ".$txt.""; // Datei-Anhang verarbeiten if(isset($_FILES['file_'.$formid]['name']) && $_FILES['file_'.$formid]['name'] != ""){ $split = pathinfo($_FILES['file_'.$formid]['name']); $filename = $split['filename']; $fileType = $split['extension']; // Erlaubte Endungen / Dateigröße überprüfen if(in_array($fileType,$allowed_endings) && $_FILES['file_'.$formid]['size'] <= $allowed_filesize){ $boundary = strtoupper(md5(uniqid(time()))); $mail_header .= "\nMIME-Version: 1.0".""; $mail_header .= "\nContent-Type: multipart/mixed; boundary=\"".$boundary."\""; $mail_body = "\nMIME-Version: 1.0".""; $mail_body .= "\nContent-Type: multipart/mixed; boundary=\"".$boundary."\""; $mail_body .= "\n\nThis is a multi-part message in MIME format -- Dies ist eine mehrteilige Nachricht im MIME-Format"; // "Normalen" Text-Inhalt einfügen: $mail_body .= "\n--".$boundary.""; $mail_body .= "\nContent-Type: text/plain"; $mail_body .= "\nContent-Transfer-Encoding: 8bit\n"; $mail_body .= $mail_content; $mail_body .= "\n--".$boundary.""; echo $mail_content; $file_content = fread(fopen($_FILES['file_'.$formid]['tmp_name'],"r"),$_FILES['file_'.$formid]['size']); $file_content = chunk_split(base64_encode($file_content)); $mail_body .= "\nContent-Type: ".mime_content_type($_FILES['file_'.$formid]['name'])."; name=\"".stripslashes($_FILES['file_'.$formid]['name'])."\""; $mail_body .= "\nContent-Transfer-Encoding: base64"; $mail_body .= "\nContent-Disposition: attachment; filename=\"".stripslashes($_FILES['file_'.$formid]['name'])."\""; $mail_body .= "\n\n".$file_content.""; $mail_body .= "\n--".$boundary.""; echo $mail_content; } else $error = TRUE; } // Wenn kein Datei-Anhang ausgewählt wurde else{ $mail_body = $mail_content; //echo $mail_content; } foreach($empf as $empf_mail){ //echo $mail_header."<br /><hr><br />".$mail_body; mail($empf_mail,$formname,$mail_body,$mail_header); } $return .= "<br /><p style=\"border: 1px solid green; padding: 5px;\"> <b>Ihre Bewerbung wurde erfolgreich verschickt und wird so schnell wie möglich bearbeitet.</b></p>"; } if(isset($_POST['submit_'.$formid]) && !empty($_POST['submit_'.$formid]) && $error){ $return .= "<br /><p style=\"border: 1px solid red; padding: 5px;\"> Sie haben nicht alle benötigen Felder (*) ausgefüllt oder den Spamschutzcode nicht richtig eingegeben.</p>"; } } else $formid = rand_String(12); /*value=\"".$data['anrede']."\"*/ $return .= " <form enctype=\"multipart/form-data\" action=\"".$_SERVER['PHP_SELF']."\" method=\"post\"> <table cellpadding=\"0\" cellspacing=\"5\" class=\"formtab pluginwidth\"> <tr> <td>Anrede *</td> <td> <select name=\"anrede_".$formid."\" style=\"width: 150px; \"> <option> </option> <option>Herr</option> <option>Frau</option> </select></td> </tr> <tr> <td>Vor- u. Nachname *</td> <td><input class=\"tx\" type=\"text\" name=\"name_".$formid."\" value=\"".$data['name']."\" style=\"width: 150px; \" /></td> </tr> <tr> <td>Strasse u. Hausnummer *</td> <td><input class=\"tx\" type=\"text\" name=\"strnr_".$formid."\" value=\"".$data['strnr']."\" style=\"width: 150px; \" /></td> </tr> <tr> <td>PLZ u. Ort</td> <td><input class=\"tx\" type=\"text\" name=\"plzort_".$formid."\" value=\"".$data['plzort']."\" style=\"width: 150px; \" /></td> </tr> <tr> <td>Telefon</td> <td><input class=\"tx\" type=\"text\" name=\"tel_".$formid."\" value=\"".$data['tel']."\" style=\"width: 150px; \" /></td> </tr> <tr> <td>E-Mail *</td> <td><input class=\"tx\" type=\"text\" name=\"email_".$formid."\" value=\"".$data['email']."\" style=\"width: 150px; \" /></td> </tr> <tr> <td>Datei max. 5 MB</td> <td><input type=\"file\" name=\"file_".$formid."\" /></td> </tr> <tr> <td valign=\"top\">Nachricht *</td> <td><textarea class=\"tx\" name=\"nachricht_".$formid."\">".$data['nachricht']."</textarea></td> </tr> <!--captcha--> <tr> <td>Sicherheitscode</td> <td><img src=\"".$pfad."secimg.php?formid=".$formid."\" alt=\"Sicherheitscode (Spamschutz)\" title=\"Sicherheitscode: Anti-Spam-System\" width=\"90\" height=\"30\" /></td> </tr> <tr> <td>Sicherheitscode eingeben *</td> <td> <input type=\"text\" class=\"tx\" name=\"captcha_".$formid."\" maxlength=\"6\" style=\"width: 150px; \" /> </td> </tr> <input type=\"hidden\" name=\"formid\" value=\"".$formid."\" /> <tr> <td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"submit_".$formid."\" value=\"Absenden\" /></td> </tr> </table> </form>"; return $return; } } if(!function_exists("rand_String")){ function rand_String($laenge){ mt_srand((double)microtime()*1000000); $zahl = mt_rand(1000, 9999); $passzahl = md5($zahl); $newpass = substr($passzahl,0,$laenge); return $newpass; } } if(!function_exists("check_mail")){ function check_mail($email){ if(filter_var($email, FILTER_VALIDATE_EMAIL)) return TRUE; else return FALSE; } } // Mime-Typen von Dateien bestimmen /*$filename Dateiname zu dem der Dateityp bestimmt werden soll RETURN: Mime-Typ */ if(!function_exists('mime_content_type')) { function mime_content_type($filename) { $mime_types = array( 'txt' => 'text/plain', 'htm' => 'text/html', 'html' => 'text/html', 'php' => 'text/html', 'css' => 'text/css', 'js' => 'application/javascript', 'json' => 'application/json', 'xml' => 'application/xml', 'swf' => 'application/x-shockwave-flash', 'flv' => 'video/x-flv', // images 'png' => 'image/png', 'jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'gif' => 'image/gif', 'bmp' => 'image/bmp', 'ico' => 'image/vnd.microsoft.icon', 'tiff' => 'image/tiff', 'tif' => 'image/tiff', 'svg' => 'image/svg+xml', 'svgz' => 'image/svg+xml', // archives 'zip' => 'application/zip', 'rar' => 'application/x-rar-compressed', 'exe' => 'application/x-msdownload', 'msi' => 'application/x-msdownload', 'cab' => 'application/vnd.ms-cab-compressed', // audio/video 'mp3' => 'audio/mpeg', 'qt' => 'video/quicktime', 'mov' => 'video/quicktime', // adobe 'pdf' => 'application/pdf', 'psd' => 'image/vnd.adobe.photoshop', 'ai' => 'application/postscript', 'eps' => 'application/postscript', 'ps' => 'application/postscript', // ms office 'doc' => 'application/msword', 'rtf' => 'application/rtf', 'xls' => 'application/vnd.ms-excel', 'ppt' => 'application/vnd.ms-powerpoint', // open office 'odt' => 'application/vnd.oasis.opendocument.text', 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', ); $ext = strtolower(array_pop(explode('.',$filename))); if (array_key_exists($ext, $mime_types)) { return $mime_types[$ext]; } elseif (function_exists('finfo_open')) { $finfo = finfo_open(FILEINFO_MIME); $mimetype = finfo_file($finfo, $filename); finfo_close($finfo); return $mimetype; } else return 'application/octet-stream'; } }[/php] [/QUOTE]
Bilder bitte
hier hochladen
und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Zitate einfügen…
Authentifizierung
Wenn ▲ = 7, ▼ = 3, ◇ = 2 und die Summe von ▲ und ▼ durch ◇ geteilt wird, was ist das Ergebnis?
Antworten
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
Formular mit Uploadfunktion
Oben