File Upload class - 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: File Upload class (/showthread.php?tid=9236) |
File Upload class - El Forum - 06-17-2008 [eluser]E303[/eluser] I can't seem to get the File Upload to work.. This is my model Code: function exhibitionsAddDB() The error I get is Quote:A PHP Error was encountered Then Quote:A PHP Error was encountered File Upload class - El Forum - 06-18-2008 [eluser]gtech[/eluser] You do not pass $picuture (in your case $_FILES['userfile']) to $this->upload->do_upload(); if userfile was c:\image.jpg in your code above do_upload would of looked for a post variable called c:\image.jpg... which of course is silly. instead just do: Code: function exhibitionsAddDB() Also $file_data['full_name'] does not exist you can either have 'full_path' or 'file_name' but not full_name. File Upload class - El Forum - 06-18-2008 [eluser]E303[/eluser] Thanks for that.. Now I just get on error Quote:A PHP Error was encountered Code: function exhibitionsAddDB() Also when I look in the uploads file I don't see the file so I guess it doesn't get uploaded? File Upload class - El Forum - 06-19-2008 [eluser]gtech[/eluser] sorry it should be Code: 'picture' => $file_data['upload_data']['file_name'], or Code: 'picture' => $file_data['upload_data']['full_path'], As if you look at the code above, it adds the results of upload->data() to an associative array with the key 'upload_data' If your stuck don't be frightened to read the code in the libraries directory (upload.php) you can then see how the functions work. have a search for 'function data' and 'function do_upload' for example, its all in php so relatively easy to follow. File Upload class - El Forum - 06-19-2008 [eluser]E303[/eluser] Thanks I think that is doing the trick. However at the moment I have the script installed on a subdomain so the upload path isn't apparently valid. Do you have any clues as to how I should write it? File Upload class - El Forum - 06-24-2008 [eluser]E303[/eluser] Any idea on the path issue? The file still doesn't seem to get uploaded. File Upload class - El Forum - 06-24-2008 [eluser]ontguy[/eluser] is that directory writable? you could use the file helper to check, it should look something like this: Code: $this->load->helper('file'); File Upload class - El Forum - 06-24-2008 [eluser]E303[/eluser] Thanks it seems to be working now. I didn't actually do anything so, im not sure why it has just started working? |