help with multipart forms, attachments, and emails |
[eluser]intoitdaily[/eluser]
Hey all. I was wondering if this was possible. I have a form that has a couple of input fields, an upload field, and a textbox. When someone submits the form, I would like to format an email and attach their uploaded file, then send the email. I'm having trouble figuring out how to do this in one step. I have a form that only uploads a file (i found it in the docs), and then another contact form that functions properly. but how would i get the multipart form input within the same contact form?
[eluser]intoitdaily[/eluser]
you don't understand. I can email and attach no problem... it's having a form that has input fields AND a file upload field, then when submitted, uploads the file and attaches it to an email, then sends it, all in the same step. I know how to have a form with only input fields, then when submitted, sends an email I know how to upload a single file to the server I know how to attach a file to an email and send it. But i don't know how to put all those together in one form.
[eluser]gtech[/eluser]
load a view with a form and add as many inputs as you desire: Code: <form action="<?=site_url()?>/uploader/upload" enctype="multipart/form-data" method="post"> then in your uploader controller Code: function upload() I havn't tested it.. but you get the idea.
[eluser]gtech[/eluser]
IN addition to the code above.. when calling do_upload() with no paramter your file input in the form has to be named 'userfile'. if you are using my example you need to create a directory called uploads in the root of your CI install, and dont forget to configure the email prefs.
[eluser]intoitdaily[/eluser]
perfect buddy! Thanks! I'll test that soon and reply with the results. |
Welcome Guest, Not a member yet? Register Sign In |