I have a controller class which is in modules/moduleName/classes/controller/admin/ directory. In this class I have two routines. a) action_index b) uploadZip
I have one file for UI in modules/views/uploadfile.php Code is as
<form method="post" action='uploadZip' enctype="multipart/form-data">
<input type='file' name='file' />
<input type="text" name="xyz" value="test data" />
<input type='submit' name="upload" value='Upload' />
</form>
I am not getting the $_POST and $_FILES array. If I change form method from "post" to "get" then I get the form data. I am us开发者_StackOverflowing Kohana framework. Please help me out.
Seems OK. Check the HTML output in your browser, maybe you have nested forms (which is not allowed)?
This is a Kohana issue, not an HTML, PHP issue. Your code works fine without Kohana.
So that being said, my guess is that you have code that is filtering out your $_POST and $_FILES variables before your check them. Consider moving your print_r() statements to the very, very top of your "uploadZip" page.
Also, from the Kohana User Guide:
The Validate object will remove all fields from the array that have not been specifically named by a label, filter, rule, or callback. This prevents access to fields that have not been validated as a security precaution.
So my guess is that you are including code that is removing these fields, since you haven't specifically listed them.
Lastly, it's good practice to use only double quotes within HTML tags -- it looks like you have a mixture of both single and double quoted tag parameters.
精彩评论