Sabtu, 19 Mei 2012

Siaran Langsung TVONE

Skype! Online Chat  

PHP
Kirim attachment file dengan php
Untuk kirim attachment file ada penambahan script dari yang biasa kita mengirim email tanpa

attachment file berikut ini script untuk attachment file beserta dengan html dan bisa langsung

di gunakan :
<?
$adminEmail = "$_POST[adminEmail]";
             
if($_POST['submit']) {
                   
    $to = $_POST['to'];
    $subject = $_POST['subject'];                         
                   
    $pengantar=$_POST[pengantar];
                                       
    $pengantarok =

"Dear&nbsp;&nbsp;".ucfirst(strtolower($_POST['Salutation']))."".ucfirst(strtolower($_POST['Suren

ame'])).",<br><br>";
    $pengantarok2 = "$pengantar<br><br>";
    $pesan = "<table width=700 border=0 cellpadding=0 cellspacing=0 align=center>
        <tr><td height='10'></td></tr>
        <tr><td>$pengantarok</td></tr><tr><td>$pengantarok2</td></tr><tr><td>
    <table width=700 border=0 cellspacing=0 cellpadding=0>
    <tr>
      <td height=25></td>
    </tr>
    </table>
    </td></tr></table>";   
                   
    $attach      = $_FILES['file1']['tmp_name'];
      $attach_type = $_FILES['file1']['type'];
      $attach_name = $_FILES['file1']['name'];
   
      $headers = "From: $adminEmail";


    // Generate string untuk batas (boundary)
    $semi_rand     = md5(time());
    $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
         
    // Tambahkan header untuk file yang akan dikirim
    $headers .= " MIME-Version: 1.0 " .
              "Content-Type: multipart/mixed; " .
              " boundary="{$mime_boundary}"";
       
    // Tambahkan pesan
    $message .= "Ini adalah pesan berbentuk multi-part dalam format MIME format. " .
             "--{$mime_boundary} " .
             "Content-Type: text/html; charset="iso-8859-1" " .
             "Content-Transfer-Encoding: 7bit " .
             $pesan . " ";
    $message .= "--{$mime_boundary} ";

     // Apabila ada file yang di attach   
        if (is_uploaded_file($attach)) {   
            // Baca file yang akan di attach/kirim ('rb' = read binary)
            $file = fopen($attach,'rb');
            $data = fread($file,filesize($attach));
            fclose($file);
                   
            // Untuk transisi data gunakan base64_encode();
            $data = chunk_split(base64_encode($data));
           
            // Tambahkan pesan pada file yang dikirim.
            $message .= "Content-Type: {$attach_type}; " . "

name="$attach_name" " .
   
            "Content-Transfer-Encoding: base64 " . $data . " ";
   
            $message .= "--{$mime_boundary} ";           
       
        }
 
$body = "$message";
                               
       
mail($to, $subject, $body, $headers);
                 
echo '<b>Your mail had been send to '.$to.' recipients</b>';


} else {

?>                   
      <form name="letter" action="" method="post" enctype="multipart/form-data">
      <table width="100%"  border="0" cellspacing="0" cellpadding="5">
          <tr>
            <td width="23%">Salutation</td>
            <td width="77%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><input type="radio" name="Salutation" value="Mr.">Mr.&nbsp;<input type="radio" name="Salutation" value="Mrs.">Mrs.</font></td>
          </tr>
          <tr><td colspan="2" height="10"></td></tr>
          <tr>
            <td width="23%">Name To</td>
            <td width="77%"><input name="Surename" type="text" id="Surename" size="35" style="font-weight:bold" onFocus="this.value='';" value="isi sure name"></td>
          </tr>
          <tr><td colspan="2" height="10"></td></tr>
          <tr>
            <td width="23%">Email To</td>
            <td width="77%"><input name="to" type="text" id="to" size="35"

style="font-weight:bold" onFocus="this.value='';" value="isi to"></td>
          </tr>
          <tr><td colspan="2" height="10"></td></tr>
          <tr>
            <td>Subject</td>
            <td>
            <input name="subject" type="text" id="subject" size="60" style="font-weight:bold" value=""></td>
          </tr>
          <tr><td colspan="2" height="10"></td></tr>
          <tr>
            <td>From Email</td>
            <td>
            <input name="adminEmail" type="text" id="adminEmail" size="60" style="font-weight:bold" value=""></td>
          </tr>
          <tr><td colspan="2" height="10"></td></tr>
          <tr>
            <td>Pengantar Kata</td>
            <td><textarea name="pengantar" id="pengantar" rows="15" cols="80" style="width:50%"></textarea></td>
          </tr>
          <tr><td colspan="2" height="10"></td></tr>
          <tr><td colspan="2" height="10"></td></tr>
          <tr>
            <td>Attach File</td>
            <td><input type="file" name="file1"></td>
          </tr>
          <tr><td colspan="2" height="10"></td></tr>
              <tr>
                <td colspan="2"><input type="submit" name="submit" value="Send Mail"></td>
              </tr>
            </table>
          </form>
<? } ?>


Share |


car insurance, nick.madigan@baltsun.com
15/05/2012 10:05:57
说:As i genuinely like the things you publish here. Extremely unusual and even brilliant. 1 dilemma however. I’m operating Chrome through Debian and even pieces from your up-to-date theme articles is a modest wonky. As i notice it’s a fantastic normal put together. However it’s a little something to help you preserve in mind. As i hope going without shoes will certainly allow and even continue to keep up the top high-quality authoring.
car insurance qoutes, geoff@deconcept.com
13/05/2012 12:05:52
I am trying to help you, please provide the information requested…Here is what I get when I run it on my host:[~]# php -f ocsdiff.php[~]#Here are what my permissions look like:[~]# ls -al ocsdiff.php-rw-r–r– 1 usermasked groupmasked 5433 Dec 19 16:06 ocsdiff.phpDid you do something like download to Windows, edit it there and then upload it to your Linux/UNIX host? If so you may want to download it directly to the UNIX host and edit it there. Windows has a nasty habit of converting line endings in UNIX (line feed) to CR and LF, so that could also be the root of your problem. As noted, I am trying to help you but you also need to play a part in this …. Cura te ipsum
car insurance, wiznordic@dishmail.net
13/05/2012 12:05:18
а, ну пардон, мой косяк, я просто не совсем понятно выражаюсь, не понели мы друг друга. ну я тогда «Ð·Ð°Ñ€Ñ‹ÑÐºÐ½ÑƒÐ»» и заявку на общагу написал, а потом мне все-таки милым голосом сказали, что в этом году в плане общаг ловить уже нечего. ну я на другое и не рассчитывал блджад – это почти что бессмысленное слово-паразит, нравится оно мне =)и да, на бюджет, спец. – информационные системы и технологии в здравоохранении
Kailan, info@paramythia.gr
12/05/2012 17:05:33
http://www.insurerservice.com/|home insurance bqmbs http://www.myedservice.com/|order cialis 752
home insurance, fmd@sendrilon.org.ph
03/05/2012 11:05:57
Why are you trying to run the config file, you would run the diskreport.php file which would load the configuration file. That said there is no reason the file should not run if you have the appropriate permissions set, have PHP installed, and call it correctly. Typically the report file is run from a cron job where PHP is called and the file name is passed to the PHP interpreter. If for some reason you want to run this form the command line you must use the command:php -f filename.phpIf that doesn’t help then please let me know how you are running the file and what version of PHP you are using.
Kristy, anita.bauer@oiag.at
02/05/2012 19:05:03
http://www.insuranceslife.net/|life insurance 02420 http://www.lifeinsurers4u.com/|life insurance quotes fkbg
Heaven, course-info@phas.ubc.ca
30/04/2012 14:04:52
http://www.choosecarinsurers.com/|car insurance in florida =O http://www.lifeinsurers4u.com/|life insurance quotes 1500
life insurance, jsb@citiz.net
19/04/2012 11:04:42
Thanks. I have recommended your post Nginx+php-fpm: upstream sent too big header while reading response header from upstream – 0×007 Team to my followers.
Kan, lisa.l@crs.org.nz
15/04/2012 10:04:14
Thanks. I have recommended your post Nginx+php-fpm: utspream sent too big header while reading response header from utspream 0 007 Team to my followers.
affordable auto insurance, krista@accvet.net
12/04/2012 07:04:15
[root@glpi reports]# php -f ocsdiff.phpPHP Notice: Undefined variable: curramresults in /var/www/html/ocsreports/reports/ocsdiff.php on line 112PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /var/www/html/ocsreports/reports/ocsdiff.php on line 112PHP Notice: Undefined variable: snapramresults in /var/www/html/ocsreports/reports/ocsdiff.php on line 113PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /var/www/html/ocsreports/reports/ocsdiff.php on line 113PHP Notice: Undefined variable: currdiskresults in /var/www/html/ocsreports/reports/ocsdiff.php on line 114PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /var/www/html/ocsreports/reports/ocsdiff.php on line 114PHP Notice: Undefined variable: snapdiskresults in /var/www/html/ocsreports/reports/ocsdiff.php on line 115PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /var/www/html/ocsreports/reports/ocsdiff.php on line 115
Ethem, daisy@ptx.hk
10/04/2012 08:04:16
[root@glpi reports]# php -f oscfidf.phpPHP Notice: Undefined variable: curramresults in /var/www/html/ocsreports/reports/oscfidf.php on line 112PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /var/www/html/ocsreports/reports/oscfidf.php on line 112PHP Notice: Undefined variable: snapramresults in /var/www/html/ocsreports/reports/oscfidf.php on line 113PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /var/www/html/ocsreports/reports/oscfidf.php on line 113PHP Notice: Undefined variable: currdiskresults in /var/www/html/ocsreports/reports/oscfidf.php on line 114PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /var/www/html/ocsreports/reports/oscfidf.php on line 114PHP Notice: Undefined variable: snapdiskresults in /var/www/html/ocsreports/reports/oscfidf.php on line 115PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /var/www/html/ocsreports/reports/oscfidf.php on line 115
Roussely, carenjames40@hotmail.com
10/04/2012 08:04:01
I am trying to help you, pseale provide the information requested Here is what I get when I run it on my host:[~]# php -f ocsdiff.php[~]#Here are what my permissions look like:[~]# ls -al ocsdiff.php-rw-r r 1 usermasked groupmasked 5433 Dec 19 16:06 ocsdiff.phpDid you do something like download to Windows, edit it there and then upload it to your Linux/UNIX host? If so you may want to download it directly to the UNIX host and edit it there. Windows has a nasty habit of converting line endings in UNIX (line feed) to CR and LF, so that could also be the root of your problem. As noted, I am trying to help you but you also need to play a part in this . Cura te ipsum
mkgfzcwoemn, ugkmju@gpfksd.com
14/12/2011 23:12:58
gUGLXI , [url=http://zpaqrfmzznzl.com/]zpaqrfmzznzl[/url], [link=http://nfouskdwghyw.com/]nfouskdwghyw[/link], http://zxuetgqxfbmj.com/
bgfhrujs, yfvprb@oloilo.com
14/12/2011 23:12:21
S4PI5w , [url=http://hurtsqqndmqi.com/]hurtsqqndmqi[/url], [link=http://ogbcgwqhbsvp.com/]ogbcgwqhbsvp[/link], http://oryxlpgtjfjk.com/
khnvkyb, rbzfcq@yqfpir.com
14/12/2011 18:12:22
21QuVH bcnvyroavmsp
txkhrc, nhnhqj@ubeonu.com
14/12/2011 02:12:28
zU2hPU fjqhutcjqyah
Eddi, p.skoprepron@mail.be
14/12/2011 00:12:00
Yo, that`s what`s up truthuflly.
Chamomile, webmaster@tsjl.net
13/12/2011 22:12:41
I went to tons of links boefre this, what was I thinking?

Add Your Comment
Name
Email Address
Website / URL
Message
Mak [600] Karakter
Verify code




Sign up for PayPal and start accepting credit card payments instantly.

copyright © 2004 - 2010 All Rights Reserved, Web Development - iman@imanmaulana.com Telp : (+6221) 91697901, (+62-815) 8778104