Welcome Guest, Not a member yet? Register   Sign In
file->move returns 1 not a file
#1

ci 4.5.1. I'm using as per the docs,
PHP Code:
$file=$file->move('todir','newname',true);
   
log_message('debug',$file->getSize());

   
the file is moved correctly.
   
according to the docs and line 153 of system/files/file.php$file->move(...) returns a File [return new self($destination)]
   
but $file->getSize() crashes  saying "Call to a member function getSize() on true" 
Many thanks, Bill
Reply
#2

(This post was last modified: 07-30-2024, 07:36 PM by kenjis.)

You are probably using UploadedFile, not File.
See https://github.com/codeigniter4/CodeIgni...#L130-L132

But UploadedFile extends File. So changing the return type is a violation of LSP.
Reply
#3

you're right (of course). I wasn't aware of Uploaded file. the source file is an upload and file->move(..) worked fine so i didn't search any further
thanks, Bill
Reply




Theme © iAndrew 2016 - Forum software by © MyBB