CodeIgniter Forums
Uploading files always null - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forum-31.html)
+--- Thread: Uploading files always null (/thread-74666.html)



Uploading files always null - machinex002 - 10-22-2019

Help, for some reason i cannot get the uploaded files... It always say "Call to a member function getSize() on null "

This is my controller function

PHP Code:
public function upload_macro(){
helper('form');
helper('file');
$data["msg"]="";
$myfile $this->request->getFile('myfile');
$myfile->getSize('mb');
return 
view('home_upload_macro',$data);


My View
PHP Code:
<form action="<?php echo base_url("home")?>/upload_macro" method="post">
 
    <input type="file" name="myfile" />
     <
input type="submit" value="upload"/>
</
form



RE: Uploading files always null - machinex002 - 10-22-2019

nevermind, I forgot to put enctype="multipart/form-data" to <form> Big Grin