Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get rid of a filesize() warning in PHP?

Tags:

php

filesize

Other than turning warnings off.. what can I do in my code to get rid of this error:

warning: filesize() [function.filesize] stat failed for ....  on line 152

The code is:

$store_filesize = filesize($file->filepath);
like image 335
Shamoon Avatar asked Dec 09 '22 07:12

Shamoon


1 Answers

I'm not sure if this is what you want (e.g. I'm not clear if you want to work out why it's happening and work around it) but if you are just looking to suppress errors you can usually use @ in front of the function name.

e.g.

$store_filesize = @filesize($file->filepath);
like image 108
Iain Collins Avatar answered Dec 28 '22 22:12

Iain Collins