Empty file upload field |
[eluser]tj530[/eluser]
Currently, i can hit upload in my form without choosing a file and it will still run the code. I tried adding code so that my code would stop if there is no file chosen to upload but it wont work. Can someone please help me with this. MY FUNCTION Code: function upload_image($field = 'userfile') My View Code: <?php My Model Code: function do_upload($userid) {
[eluser]Madmartigan1[/eluser]
if ($this->input->post('upload'))... Im not 100% sure without seeing your whole code, but you should be checking the $_FILES array instead of the $_POST array. Is 'upload' the name of the file upload field? EDIT: Sorry I missed that line. Ignore me :down: Take a look at the upload class.
[eluser]tj530[/eluser]
i just want to know why this doesnt work?!: Code: if ( ! isset($_FILES[$field])){
[eluser]Madmartigan1[/eluser]
Try checking if $_FILES['userfile'] is empty instead of set.
[eluser]tj530[/eluser]
i did this just now and it didnt work Code: if (empty($_FILES[$field])){
[eluser]tj530[/eluser]
ok nvm im stupid. i got it. small stupid mistakes are my worst enemies! |
Welcome Guest, Not a member yet? Register Sign In |