-1

I had send word document file in my mail when i send this document at that time it will generate unknown format like asdfADFDF 0000sadfas15454454

I had use mail function for sending mail .

Here is my code for that please check and let me know .

function sendfile()
{
    $id = $_REQUEST['id'];
    $s=mysql_query("select * from file_doc where id='".$id."'");
    $r= mysql_fetch_array($s);
    $r['email']; // user email address

    $docfile = "upload/".$r['cv']; // $r['cv'] is docfile



}
mayur panchal
  • 265
  • 1
  • 16

1 Answers1

0

Try:

if (isset($_FILES['uploaded_file']) &&
    $_FILES['uploaded_file']['error'] == UPLOAD_ERR_OK) {
    $mail->AddAttachment($_FILES['uploaded_file']['tmp_name'],
                         $_FILES['uploaded_file']['name']);
}

Basic example can also be found here.

The function definition for AddAttachment is:

public function AddAttachment($path,
                              $name = '',
                              $encoding = 'base64',
                              $type = 'application/octet-stream')
kuldip Makadiya
  • 706
  • 4
  • 23