Both methods returns the extention of the uploaded file, so why they both existe ?
Can’t find any diffrence between them.
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
These methods are available on every
getClientOriginalExtension() returns the extension extracted from the original file name. If you send
image.png, it’ll be
extension() returns the extension extracted from the file itself (using the mime type).
For instance, if you have a
image.pdf file, you rename it
image.png and then you upload it to your app:
nullif the mime type cannot be read)
getClientOriginalExtension gets CLIENT extension, not the real mime-type extension, to get that use
extension it is more secure