Benko's avatar
Level 6

Read uploaded file

Is there a way to read file contents uploaded via form before it gets saved on the server? Can't seem to find anything.

0 likes
1 reply
bobbybouwmann's avatar
Level 88

You can get the info and content of the file like so

$file = $request->file('image');

This will return an object of the class UploadedFile. You can perform methods on this or do other things with it before you save it.

If you're looking into modifying files before saving them I would recommend this library: http://image.intervention.io/getting_started/introduction

1 like

Please or to participate in this conversation.