php - Check JSON file when uploading -
i creating upload function want upload json file.
my json string inside file :{"name":"john"}
my php code:
$filetype = $_files['uploaded']['type']; if ($filetype != "application/json") { print 'not valid json file'; }
also tried:
$filetype = $_files['uploaded']['type']; if ($filetype != "text/json") { print 'not valid json file'; }
when trying upload json file shows me 'not valid json file' error.
plz me wrong code.
there no explicit file type set when creating *.json files. instead files mime-type going application/octet-stream
, binary file, typically application or document has opened in application.
check array $_files['uploaded']
type.
Comments
Post a Comment