Welcome Guest, Not a member yet? Register   Sign In
File Upload and userfile
#1

[eluser]obobo[/eluser]
I am using the File Upload Class
and in my controller need to test to see whether the file input field has been filled in by the user

but when i try to use $this->input->post('userfile')
i get an empty value, even when i have selected a file from my local hard drive.

is there any reason why userfile wouldn't be showing up as a POST variable?
#2

[eluser]wiredesignz[/eluser]
Because 'userfile' is not in $_POST, it is in $_FILES
#3

[eluser]Randy Casburn[/eluser]
[edited ... as my post was irrelevant...because I didn't read the original post...because I'm a duber :-)]
#4

[eluser]obobo[/eluser]
Thanks for the tips.

Randy .. Yeah I'm using the cI library and it's saved me a lot of time and pain ... In this particular case though i needed to test for whether userfile was empty before running the do_upload.
#5

[eluser]xwero[/eluser]
You can do it with
Code:
if($_FILES['userfile']['error'] != 4)
{
   // do upload
}
else
{
  // no file
}
#6

[eluser]obobo[/eluser]
thanks xwero.
#7

[eluser]Yunus Khan[/eluser]
You can find the uploaded image name using following code

Code:
$_FILES['userfile']['name']




Theme © iAndrew 2016 - Forum software by © MyBB