Welcome Guest, Not a member yet? Register   Sign In
I cant reach the post value
#1

[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,
#2

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

InsiteFX
#3

[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'];
#4

[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.




Theme © iAndrew 2016 - Forum software by © MyBB