Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Upload Class won't see $_FILES
abarcenas
February 2013
I've taken too much time on this. It seems that the Upload Class is not working. I followed the document and came with this:
public function action_file()
{
$path = DOCROOT . 'assets\uploads';
$setting = array(
'path' => trim($path),
'ext_whitelist' => array('png','jpeg','jpg'),
'overwrite' => true
);
\Fuel\Core\Upload::process($setting);
if(\Fuel\Core\Upload::is_valid())
{
\Fuel\Core\Upload::save();
print \Fuel\Core\Upload::get_files();
}
}
My View:
<form action="../public/debug/file" method="POST" enctype="multipart/form-data">
<?php print Fuel\Core\Form::file('file_name') ?>
<input type="hidden" value="placeholder" name="pl"/>
<input type="submit" value="submit" id="submit"/>
</form>
once I submit, I don't see any results. It seems that is_valid == false. I remove it and do upload::save() then upload::get_files(), but it seems it didn't received $_FILES for some reason. I print_r($_FILES) and there is data in it.
I ask, what am I missing here?
Harro
February 2013
Upload works fine.
If $_FILES contains data, my guess is that validation has failed.
Debug::dump(Upload::get_files(), Upload::get_errors());
to see which files valdated (first array), and which ones failed (second array). For the failed ones, it will list the reasons why.
abarcenas
March 2013
The problem was my whitelist entries are wrong in the config. Using the default settings worked.
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
abarcenas
March 2013
Harro
February 2013