Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2010
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts

    PHP Form Mail w/ Multiple Attachments?

    I'm looking for a good "contact" php form that allows multiple files to be uploaded and attached to the email the form sends to a specified email.

    I have found some that do this but all are ones that use a separate field for each file to browse, I'm hopefully looking to find one that can upload multiple files via one field.. one such a seen here (top uploader):
    http://the-stickman.com/files/mootools/multiupload/
    ( http://the-stickman.com/web-developm...-file-element/ )

    Another example of multiple upload via one field..:
    http://15daysofjquery.com/examples/multiFile/demo1.php
    ( http://15daysofjquery.com/multiple-f...javascript/17/ )

    If anyone knows of any o
    r can implement that one (the source code is for download off that page) that would be great.

    Thanks
    Last edited by Toups; 02-08-2010 at 04:30 PM.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    That is Javascript (more specifically, frameworks mootools and jQuery) that takes care of the multiple files per field thing. The jQuery one actually adds input elements to the DOM but hides them, so when the form is submitted, PHP thinks it was three separate input elements loaded with a file to upload. Each element is named fileX[] so it comes across as an array in your $_FILES array.

    So... I'm not sure if this answers your question, or what exactly are you stuck on?

  • #3
    New Coder
    Join Date
    Jan 2010
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fumigator View Post
    That is Javascript (more specifically, frameworks mootools and jQuery) that takes care of the multiple files per field thing. The jQuery one actually adds input elements to the DOM but hides them, so when the form is submitted, PHP thinks it was three separate input elements loaded with a file to upload. Each element is named fileX[] so it comes across as an array in your $_FILES array.

    So... I'm not sure if this answers your question, or what exactly are you stuck on?

    I'm stuck on then using that array in a form with other fields to send it to an email..
    I have found php forms that can send attachments to email but I'm not sure how to implement this file browse into the form to allow the form to send the attachments in the email.

  • #4
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    You are doing two things here. You are collecting filenames for upload to your server, and you are then going to send those uploaded files in an email as attachments.

    I recommend you work on one of these parts at a time. Get the upload process working first-- if you are unfamiliar with how PHP handles file uploads, here's a good place to start:

    http://us2.php.net/manual/en/feature...ost-method.php

    The manual also has a separate page that discusses multiple file uploading:

    http://us2.php.net/manual/en/feature...d.multiple.php

    The example on that page uses multiple input elements, but remember, that jQuery script produces multiple input elements, even though that's not what the user sees. So you should be able to walk through that example and gain an good understanding of how it works.

    Once you have the upload working, you can move on to the email attachment part, and I would recommend using PHPMailer for that.

    http://phpmailer.worxware.com/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •