You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jonny Wray <jo...@yahoo.com> on 2004/07/13 20:17:27 UTC
Upload file type specification
Hi,
I'm using the upload component succesfully, but I need to limit the
file types the user can choose to excel. I included the informal
parameter accept="Application/vnd.ms-excel" to the @Upload component,
but this does not work.
Does anyone know how to do this?
thanks
Jonny
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Upload file type specification
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
We wrote our own ValidUpload component that wraps the Upload component
and rejects the upload if it is not in a list of mime types we provide
as a parameter. I don't currently have the time to package it up nice
and neat and contribute it, but it was pretty straightforward to do.
Erik
On Jul 13, 2004, at 2:33 PM, Jeff LaMarche wrote:
> With HTML 4.0, you can use the "accept" parameter to the input tag,
> but it uses mime types with some wildcarding ability, like:
>
> <input type="file" accept="image/gif,image/jpeg"/>
>
> or
>
> <input type="file" accept="image/*"/>
>
> But HTML 3.2 references but does not require browsers to enforce this,
> so no matter what you do, you're going to have to do server-side
> checks.
>
> Hope this helps.
>
> Jeff
>
> References:
> HTML 4.0 spec:
> http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accept
> HTML 3.2 spec: http://www.w3.org/TR/REC-html32#input
>
>
>
> On Jul 13, 2004, at 2:17 PM, Jonny Wray wrote:
>
>> I'm using the upload component succesfully, but I need to limit the
>> file types the user can choose to excel. I included the informal
>> parameter accept="Application/vnd.ms-excel" to the @Upload component,
>> but this does not work.
>>
>> Does anyone know how to do this?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Upload file type specification
Posted by Jeff LaMarche <je...@mac.com>.
On Jul 13, 2004, at 3:44 PM, Jonny Wray wrote:
> Am I wrong here? Is there a way to limit the file types exposed by the
> browse button?
Well, if you specify HTML 4.0 in your doc header, technically browsers
that support HTML 4.0 should enforce it, but I don' t have any idea
what the status of HTML 4.0 support on current browsers. If you specify
3.2, the browser is free to ignore the accept parameter, and probably
will.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Upload file type specification
Posted by Jonny Wray <jo...@yahoo.com>.
Ah, maybe I misunderstood the accept parameter and what it does.
I'm already doing the server-side validation, my code works right now
no matter what the user enters. I just want only excel files to be
exposed by the browse button, and that's what I thought accept
parameter did.
Am I wrong here? Is there a way to limit the file types exposed by the
browse button?
thanks
Jonny
--- Jeff LaMarche <je...@mac.com> wrote:
> With HTML 4.0, you can use the "accept" parameter to the input tag,
> but
> it uses mime types with some wildcarding ability, like:
>
> <input type="file" accept="image/gif,image/jpeg"/>
>
> or
>
> <input type="file" accept="image/*"/>
>
> But HTML 3.2 references but does not require browsers to enforce
> this,
> so no matter what you do, you're going to have to do server-side
> checks.
>
> Hope this helps.
>
> Jeff
>
> References:
> HTML 4.0 spec:
> http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accept
> HTML 3.2 spec: http://www.w3.org/TR/REC-html32#input
>
>
>
> On Jul 13, 2004, at 2:17 PM, Jonny Wray wrote:
>
> > I'm using the upload component succesfully, but I need to limit the
> > file types the user can choose to excel. I included the informal
> > parameter accept="Application/vnd.ms-excel" to the @Upload
> component,
> > but this does not work.
> >
> > Does anyone know how to do this?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Upload file type specification
Posted by Jeff LaMarche <je...@mac.com>.
With HTML 4.0, you can use the "accept" parameter to the input tag, but
it uses mime types with some wildcarding ability, like:
<input type="file" accept="image/gif,image/jpeg"/>
or
<input type="file" accept="image/*"/>
But HTML 3.2 references but does not require browsers to enforce this,
so no matter what you do, you're going to have to do server-side
checks.
Hope this helps.
Jeff
References:
HTML 4.0 spec:
http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accept
HTML 3.2 spec: http://www.w3.org/TR/REC-html32#input
On Jul 13, 2004, at 2:17 PM, Jonny Wray wrote:
> I'm using the upload component succesfully, but I need to limit the
> file types the user can choose to excel. I included the informal
> parameter accept="Application/vnd.ms-excel" to the @Upload component,
> but this does not work.
>
> Does anyone know how to do this?
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org