Welcome Guest, Not a member yet? Register   Sign In
$_FILES not being recognised - Nothing working
#1

[eluser]Funky Fresh[/eluser]
Hey All,

Im having major problems with my CI .... I have a very basic form in my view, which has the following code

Code:
<?php echo form_open_multipart($this->uri->uri_string()); ?>
    <input class="file-input-area" name="mpfile[]" type="file" size="32" />
</form>

In my controller i have the following

Code:
if(isset($_FILES['mpfile'])){
    echo 'THIS IS A TEST';
}

The problem is, everytime i run i i see the echo'd message, even when there is no file selected in the file area ... I have tried everything to get it working as you can see from my post here -> http://stackoverflow.com/questions/43381...20#4338220

This is getting on my nerves as i have been working on it for about 6 hours and still nothing.

Cheers,
#2

[eluser]smilie[/eluser]
If I may ask, but why is the input array?!

Remove [] from the name and try again :-)

Also, take a look at the http://ellislab.com/codeigniter/user-gui...ading.html

Cheers,
Smilie
#3

[eluser]Funky Fresh[/eluser]
Hey,

Iam using several different inputs that need to be in an array, but as a test, i did take it out, and it still didnt recognise it.

Basically for the first test, i just need to see if a file has been chosen for upload .... but whatever i try wont work
#4

[eluser]smilie[/eluser]
Could you tru instead of:

Code:
<?php echo form_open_multipart($this->uri->uri_string()); ?>
to put filename (controller) in the form_open_multipart?

Also, try:
Code:
if(count($_FILES('mpfile') > 0
{
    echo 'THIS IS A TEST';
}

Cheers,
Smilie
#5

[eluser]Funky Fresh[/eluser]
Just tried that .... it returns 'THIS IS A TEST' on both occasions :S
#6

[eluser]Funky Fresh[/eluser]
Is this the only helper i need to get forms working?

$this->load->helper( 'form' );




Theme © iAndrew 2016 - Forum software by © MyBB