Send File by Email through Form on Web Site? |
[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.
[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-gui...ading.html 2. you email the file from the server to whatever email addresses you want http://ellislab.com/codeigniter/user-gui...email.html the userguide has very clear, easy to understand examples that should get you started. good luck!
[eluser]invision[/eluser]
Hi Eoin. Many thanks. I'll take a look over those URLs and may come back. Thanks
[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?
[eluser]Kamarg[/eluser]
$post isn't defined. You either want $_POST['email'] or $this->input->post('email').
[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.
[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
[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.
[eluser]invision[/eluser]
Many thanks for the reply Eoin. Here's my current VIEW for reference: View Code: <?php
[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 |
Welcome Guest, Not a member yet? Register Sign In |