Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
307 views
in Technique[技术] by (71.8m points)

php - Undefined property: IlluminateHttpUploadedFile::$name after image upload

I am trying to get the exact uploaded image size by using getimagesize() php helper on Laravel 7. But i get an error

ErrorException: Undefined property: IlluminateHttpUploadedFile::$name on the line where the code is:

if($request->file('image') != null){
        $upload = $request->file('image');
        $sourceProperties = getimagesize($upload->name);

Please help understand the issues since it only occurs on the Debian server and not locally... It works fine on local


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Not sure why but after using the php helper getRealPath() as:

getimagesize($upload->getRealPath());

Works on the server but not locally.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...