开发者

Why does UploadedFile.content_type fail in FF only for me?

开发者 https://www.devze.com 2023-04-08 12:12 出处:网络
I do a little validation in m开发者_JS百科y form and everything works in Chrome and Safari, but in FF, for whatever reason I can\'t submit my form because of the following lines:

I do a little validation in m开发者_JS百科y form and everything works in Chrome and Safari, but in FF, for whatever reason I can't submit my form because of the following lines:

    if not song.content_type in ["audio/mp3", "audio/mp4"]:
        raise forms.ValidationError("Content type is not mp3/mp4")

When I try and submit a form (with an mp3), I receive the error: "content type is not mp3/mp4". If I comment out the above two lines, everything works as planned.

This ONLY happens in FF. Chrome and Safari allow me to upload the file with the above lines in place. What gives? What does this even have to do with the browser?

Thanks in advance, this is a real mystery to me!


i think in fire fox you getting different types for them. most probably spelling issue like capitalization. just to print song.content_type and hope fully you will getting the solution by yourself

0

精彩评论

暂无评论...
验证码 换一张
取 消