hello guys. I'm a beginner of this fuelphp. i just want to ask you guys to please give me some instructions, or steps on how to create a working upload here in fuelphp. tnx
I can't find the files that I uploaded in the directory. And what do you mean by php_fileinfo extension? Do I have to download it? I already use the PATH, but nothing happened.
If you don't get an exception, I guess the fileinfo extension is present. It is by default in 5.3+, but on Windows you need to install the .dll manually.
Did you follow the documenation:
- run process()
- check for errors
- if no errors run save()
If there were any errors detected, nothing will be saved. The upload class doesn't to partial saves, unless you explicitly save a single uploaded file (which then must have no errors).
I followed the documentation, but I am not sure if the arrangement of the codes was correct. I get trouble in following the instruction, it's hard for me to follow because this is the first time that i used the fuelphp.
Hi, sorry if I'm interrupting, because I have the same problem when using Upload in Windows. I have no problem running the Upload in Ubuntu. And I'm using XAMPP 1.8.1.
public function action_create() {
if (Input::post()) {
$val = Model_Member::validate('create');
if ($val->run()) {
$config = array(
'path' => DOCROOT . DS . 'member'
);
Upload::process($config);
if (Upload::is_valid()) {
Upload::save();
$file = Upload::get_files(0);
$member = Model_Member::forge(array(
'nim' => Input::post('nim'),
'name' => Input::post('name'),
'gender' => Input::post('gender'),
'birth_place' => Input::post('birth_place'),
'birth_date' => Input::post('birth_date'),
'addr_home' => Input::post('addr_home'),
'addr_mlg' => Input::post('addr_mlg'),
'phone' => Input::post('phone'),
'photo' => $file['name']
));
if ($member and $member->save()) {
Session::set_flash('success', e('Berhasil menambahkan anggota #' . $member->member_id));
Your installation doesn't have the fopen extension installed.
It must be part of the installation per default in PHP 5.3+. If you're on Windows, you must install the dll manually. If you're on your own machine, install it. If you use a hoster, kick him because he's using outdated compile scripts to make the PHP binaries.
Hey, I just found out how to solve this problem. It's not from the code, but the extension of php_fileinfo is not activated by default in XAMPP 1.8.1. Here is the way I solved this :
Open php.ini in C:\xampp\php with your favorite editor (I use Notepad++ to open this file)
Look for line 994 and remove the semicolon mark to activate the extension=php_fileinfo.dll
Restart the apache
Now you should be able to upload your file, don't forget to insert the enctype in your form :) +