hidayat3676's avatar

How to get image path using input type file

I want to get the path once a user select the image before the submit of the file to db here is my code

 <form action="/updateProfilePicture" method="post" enctype="multipart/form-data">
                        @csrf
                        <div class="form-group">
                            <input type="hidden" name="user_id" value={{Auth::user()->id}}>
                            <input type="file" class="form-control-file" name="image" id="avatarFile" aria-describedby="fileHelp">
                            
                            <small id="fileHelp" class="form-text text-muted">Please upload a valid image file.</small>

@if(exif_imagetype('path/to/image.jpg')) 
                            // your image is valid
                            @endif 
                        </div>
                        <button type="submit" class="btn btn-primary" data-dismiss="model">Submit</button>
                    </form>

i want to check in the above if condition if the selected image is valid or not. How to do this.

0 likes
0 replies

Please or to participate in this conversation.