Hi guys,

When using tapestry-upload I stumbled across an unusual browser bug that I 
spent hours on, so wanted to share... maybe it helps someone else:

Unlike weaker implementations, UploadedFile.getContentType(); returns the mime 
type of the uploaded file by extracting it from the http header 'Content-Type' 
after the file posts. To my knowledge this is the best approach... examining 
the file extension has obvious drawbacks. Unfortunately I found Firefox 3.6.12 
sets the header incorrectly on Windows, but correctly on Linux... I am willing 
to bet some more inconsistent browser implementations exist as well, so be 
warned that while Tapestry does its part, your code may not work as expected or 
may contain subtle bugs because browsers can't be trusted to set this header 
correctly.

I am not sure if some of the tapestry gurus can come up with a better solution, 
but I work around this problem by combining checks, falling back on a file 
extension check when I detect a problem... If anyone has a better suggestion I 
would love to hear it. 

Cheers,
Peter





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to