Interesting ... and ugly.  I'm storing this in the back of my mind, along
with the question: should Ajax URLs be different than standard URLs?

On Fri, Nov 12, 2010 at 5:56 AM, <[email protected]> wrote:

> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to learn
how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

Reply via email to