As far as I understand the $request->file()
(returns Illuminate\Http\UploadedFile
) of Laravel does not return a string, even if you look in the documentation you will notice that there is no __toString
which should be the minimum for the first to return the temporary path of the file you are uploading, see the documentation:
So probably when passing the value to simplexml_load_file
it is looking for a file that is not the correct file, probably what is between ""
, what it was trying to pass was an object, so probably:
object(Illuminate\Http\UploadedFile)#1 (0) {
}
warning errors are likely to be turned off or hidden, but if it were on it would display something like:
PHP Warning: simplexml_load_file () expects parameter 1 to be a valid path, object given
The phrase object given
means that you have taken an object, the previous phrase says, parameter 1 must be a valid path, ie object is not path and not string.
How to read% content of laravel
Probably the correct one would be to use UploadedFile
+ UploadedFile::get()
, like this:
$xml = simplexml_load_string($request->file('publicacao')->get());
dd($xml);