CodeIgniter Forums
I cant reach the post value - 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: I cant reach the post value (/showthread.php?tid=38890)



I cant reach the post value - El Forum - 02-22-2011

[eluser]barisv[/eluser]
Hi,

I am submitting the form as you see in the below. It works for image uploading but I need to get userfile to create an url to add it to the database. But returns nothing when I write

$this->input->post('userfile');

Why I cant reach the value of userfile ? or does it become empty before I reach it ?


Code:
<form action="http://localhost/adminpanel/admin/addreferans" method="post" accept-charset="utf-8" enctype="multipart/form-data">

<input type="file" name="userfile" value=""  />

<input type="submit" name="upload" value="Yükle"  />

</form>


Thanks in advance,


I cant reach the post value - El Forum - 02-22-2011

[eluser]InsiteFX[/eluser]
Maybe it needs something in the value field.

InsiteFX


I cant reach the post value - El Forum - 02-22-2011

[eluser]cahva[/eluser]
Filename is not in the $_POST array. Its in the $_FILES array and thats why it cant be found in post.

If you use the File uploading class, you can use $this->upload->data() to get the information. Read more in the link to userguide.

If you dont use file uploading class, you can get the filename using:
Code:
$fname = $_FILES['userfile']['name'];



I cant reach the post value - El Forum - 02-22-2011

[eluser]barisv[/eluser]
I am using File uploading class. Thanks for your informative reply, Cahva. Thats what I needed. I have missed that part. Probably I should read more to userguide. Also thank you InsiteFX.