开发者

File type is returning null in chrome browser

I have used file uploader(used PHP) in my application.

In FireFox, and Internet Explorer8 working when I try below statement.

开发者_开发问答
print $_FILES['upladed']['type'];

But in chrome I am getting null value(not printing anything).

If I use var_dump($_FILES['upladed']['type']); then I am getting result as

string '' (length=0)

Please suggest some pointers.

Thanks

-Pravin


First of all, use var_dump($_FILES['upladed']['type']) to figure out if it's really NULL or not.

Second of all, I don't know what's wrong with Chrome, but you should not rely on this value in your PHP application. Always validate the data over the wire than checking what MIME type the browser really claims to be. In Windows, MIME types can be changed in registry, for instance.


Chrome (up to at least 8.0.552.215) has issues with content types of files. For me, it was if the file did not have an extension.

See: http://code.google.com/p/chromium/issues/detail?id=6800

Note: I'm using struts 2.0.14 with the FileUploadInterceptor (uses ServletFileUpload and JakataMultipartRequest)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜