mardi 18 janvier 2022

getRealPath() and path() return false

When uploading images on localhost, the path() method returns the file path correctly, but in production, it's returning always false. I also tried using getRealPath() but it's the same result. So I decided to use the getPathname() which is what worked.

Does anyone know why it does not work? It's a problem with some lib? I searched a lot but doesn't find anything.

getPathname() result:

string(27) "C:\Windows\Temp\phpA9AF.tmp"

$request->logo or $request->file('logo') dump result:

object(Illuminate\Http\UploadedFile)#305 (7) { ["test":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> bool(false) ["originalName":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> string(13) "Teste del.png" ["mimeType":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> string(9) "image/png" ["error":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> int(0) ["hashName":protected]=> NULL ["pathName":"SplFileInfo":private]=> string(27) "C:\Windows\Temp\phpA9AF.tmp" ["fileName":"SplFileInfo":private]=> string(11) "phpA9AF.tmp" }

path() or getRealPath()result:

bool(false)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire