문제

I'm working my way through input filtering (files) and I just discovered that if you rename a .jpg file into a .png file the MIME type will change automatically to fit the extension. So I was thinking, in that case what's the point of checking the MIME type ? (I know that it can be changed by the client which is a serious drawback too, but I'm checking it "for fun")

도움이 되었습니까?

해결책

Well, for one, the content of the file doesn't change; so if you actually check the type yourself (instead of blindly trusting user-submitted data), you'll see it's just a misnamed file.

As for the user-supplied MIME-type, checking that is an exercise in futility, yes.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top