Welcome Guest, Not a member yet? Register   Sign In
$this->input->post() help
#1

[eluser]minagabriel[/eluser]
hello guys iam trying to upload an image and i my view is
Code:
<?php echo form_open('photo/do_upload'); ?>
photos : <input type="text" name="name" />
photo caption : <textarea name="mytext" cols="30" rows="5">
please add your caption here </textarea>
<label for="file"> file name : </label>
&lt;input type="file" name="file" id="file"/&gt;
&lt;input type="submit" name="submit" value="upload" /&gt;
&lt;/form&gt;
&lt;/form&gt;

how can i pass the image data like size , name etc
i used
$this->input->post('file') and it echo the image name for me

my question is how do i get $_file['file']['size'] to my controller ?
thnx all
#2

[eluser]JuanitoDelCielo[/eluser]
Ypu need a multi part form, check the form helper adn de file upload class
#3

[eluser]minagabriel[/eluser]
i dont want to use any helper i just want to use a plain php
#4

[eluser]Cristian Gilè[/eluser]
As JuanitoDelCielo said you need the enctype="multipart/form-data" property in the form tag. This is necessary for PHP file to function properly.

Code:
&lt;?php echo form_open_multipart('photo/do_upload'); ?&gt;

The $_FILES array is where PHP stores all the information about uploaded files. In the controller you can access the file name and the file size with

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

and

$_FILES['file']['size']


Cristian Gilè
#5

[eluser]minagabriel[/eluser]
this is very strange

why when i use $_FILES it works and when i use $_files it doesnt
is it case sensetive ?




Theme © iAndrew 2016 - Forum software by © MyBB