A attachment file with a php form in wordpress

  • Author
    Posts
  • #1464661

    waseemchand
    Member

    I am making a php form in wordpress. I would like to attach a notepad or PDF file along this form.I am getting all this in email using mail function in a body variable for example :

    $body =" Attachment: $CV ";

    Instead of file i am receiving file name that user uploading instead of file.

    I am trying to receive file in email.Actually i am learning too that how to do it.

    My php code for assigning to htm file tag is,

    `if(trim($_POST[‘CV’]) === ”) {
    $CVError = ‘Please enter your CV.’;
    $CVError = true;
    } else {
    $CV = trim($_POST[‘CV’]);
    }`

    and my Html code for getting file ,

    `<li class=”left”>
    <label for=”CV”>Attachments :</label><span class=”error”>*</span><br>
    <input class=”txt” type=”file” name=”CV” id=”CV” value=”<?php if(isset($_POST[‘CV’])) echo $_POST[‘CV’];?>”>
    </li>`

    and this is my mail function code,

    $headers = ‘From: ‘.$name.’ <‘.$emailTo.’>’ . “\r\n” . ‘Reply-To: ‘ . $email;
    $headers .= “\r\n” . ‘Content-type: text/html’;
    mail($emailTo, $subject, $body, $headers);
    $emailSent = true;

    Can you help or modify my code in order to get file in email.Thanks friends.

    #1464812

    waseemchand
    Member

    Hello any help?

    #1464813

    timethief
    Member

    We do not provide support at WordPress.COM for any installs of WordPress.ORG software. We provide support only for free hosted WordPress.COM blogs being hosted right here on this multiuser blogging platform.

    WordPress.com and WordPress.org have different log-ins and run different versions of themes with same names.
    http://support.wordpress.com/com-vs-org/

    If you don’t have a username account at WordPress.ORG click http://wordpress.org/support/ and register one on the top right hand corner of the page that opens, so you can post to the support forums there and receive advice from WordPress.ORG bloggers.

    #1464815

    waseemchand
    Member

    Ohh i am really sorry.

    #1464816

    timethief
    Member

    Not to worry and best wishes with your site.

The topic ‘A attachment file with a php form in wordpress’ is closed to new replies.