Hey so this is a very simple question, but one I just can't find the answer for. I know this is how you test wether the file you uploaded is indeed an image file:
if($_FILES["file"]["type"] == "image/png")
Just swapping the png
with wichever file extension you accept. I just want to know how do I use this statement to test for a file that is an .epub file? What is the first part before the /
going to be?
Thanks in advance.
Just write a simple upload script that prints $_FILES["file"]["type"]
on the screen and upload a file of the wanted type
if (pathinfo($_FILES["file"]["name"], PATHINFO_EXTENSION) == "epub") {}
Documentation: http://php.net/manual/en/function.pathinfo.php
The type
is the client-provided MIME information. Some of the info for this is here I found on internet
Try
($_FILES["file"]["type"] == "epub")
Ok so I wrote a script that just outputs the file type and the output was "application/octet-stream"
This also worked to test wether the file is of type epub.