![]() |
Send File by Email through Form on Web Site? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Send File by Email through Form on Web Site? (/showthread.php?tid=30316) |
Send File by Email through Form on Web Site? - El Forum - 05-11-2010 [eluser]invision[/eluser] Hi, I'm putting together a very basic job application script. I want a user to be able to email a file (through a form on the web site) to me. Where would I start with this? I'm just looking for something basic that will work and then I can add to it. Many thanks for any help. Send File by Email through Form on Web Site? - El Forum - 05-11-2010 [eluser]eoinmcg[/eluser] broadly speaking, there are two steps to what you want to achieve. 1. user uploads file via form on your website. http://ellislab.com/codeigniter/user-guide/libraries/file_uploading.html 2. you email the file from the server to whatever email addresses you want http://ellislab.com/codeigniter/user-guide/libraries/email.html the userguide has very clear, easy to understand examples that should get you started. good luck! Send File by Email through Form on Web Site? - El Forum - 05-11-2010 [eluser]invision[/eluser] Hi Eoin. Many thanks. I'll take a look over those URLs and may come back. Thanks Send File by Email through Form on Web Site? - El Forum - 05-11-2010 [eluser]invision[/eluser] Quick followup. I'm proceeding fairly well with this. However, have run into some errors ![]() I want to store the ID so I know which job is being applied for. Code: <?php With this, I'm getting errors like: A PHP Error was encountered Severity: Notice Message: Undefined variable: post Filename: views/vacancies_apply.php Line Number: 10 Any ideas what may be causing this? Send File by Email through Form on Web Site? - El Forum - 05-11-2010 [eluser]Kamarg[/eluser] $post isn't defined. You either want $_POST['email'] or $this->input->post('email'). Send File by Email through Form on Web Site? - El Forum - 05-11-2010 [eluser]invision[/eluser] Aaah OK. Do I have to define it in the View? Here's my Model if it helps: Code: function apply($slug=0){ Am I on the right track from looking at the above code? Ultimately the email input field will change to a file input field. Send File by Email through Form on Web Site? - El Forum - 05-11-2010 [eluser]invision[/eluser] Could someone possibly lend a hand with this? I'm happy to provide the code I have so far, or if there is an easier solution available? Thanks for your help Send File by Email through Form on Web Site? - El Forum - 05-12-2010 [eluser]eoinmcg[/eluser] seems ok, what you're doing. what part are you specifically having trouble with? in terms of the upload and attachment; - add an upload field to the form Code: <label>File</label><input type="file" name="file" /> - after validation is successful add in a check for an uploaded file and if present process the file Code: if($_FILES['file']['name']) - obviously, you'll have to write the _do_upload() method but there's enough in the user guide to make this a trivial task. Send File by Email through Form on Web Site? - El Forum - 05-12-2010 [eluser]invision[/eluser] Many thanks for the reply Eoin. Here's my current VIEW for reference: View Code: <?php Send File by Email through Form on Web Site? - El Forum - 05-12-2010 [eluser]invision[/eluser] Hi, OK, I've managed to submit the form when attaching the file, but I now get these 2 errors when submitted: Code: A PHP Error was encountered and Code: A PHP Error was encountered The new Controller code is as follows: Controller Code: function apply($slug){ I think I see the finishing lines. Can you tell me if I've missed anything obvious? Thanks again |