ivymasterman's avatar

Why is my ZIP file being viewed as a JAR file?

I have a store endpoint, that only allows files of type 'zip'. This is my validation statement:

"file" => ["required", "file", "mimes:zip"], 

When I upload a zip file, this validation statement returns an error: "The file must be a file of type: zip."

When I remove mimes validation, it gets saved to the server, with an extension of ".jar". Can anybody share some insight, please?

0 likes
4 replies
Sinnbeck's avatar

Try running this on the commandline

file --mime-type -b myfile.zip

Does it output jar ?

ivymasterman's avatar

@Sinnbeck I transferred the file manually, via FTP. It has the zip extension, but the command outputs "application/java-archive"

Tray2's avatar

Jar, is a JavaArchive and that is basically just a zipped bunch of java files.

Java ARchive This format is a Java archive and is presented as a typical ZIP file, in which part of the program is written in Java language. It was gradually replaced by new mobile platforms, since JAR is used for launching applications and games on early generation mobile phones. They can contain a digital signature, and they’re actively used in popular browsers for storing supplements. - https://convertio.co/zip-jar/

Please or to participate in this conversation.