I have a form where the user can upload a file. The file should not be stored in my database.I want to view the contents of a file and then return a response to the user.How can i get the content. If I call by name, it just returns the file name.
<input type="file" required class="form-control" accept=".xml"id="file" name="file" multiple>
public function loadData(Request $req) {
dd($req->input('file'));
}
2
Answers
You can get the contents of the file uploaded using file_get_contents() method. Example:
From Laravel documentation: