using pathname to calculate mimetype and name