Updated to fix a possible injection. Added Mime-type checking