Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   <html:file> accept property and button's label (http://www.velocityreviews.com/forums/t135620-html-file-accept-property-and-buttons-label.html)

Smurf 07-27-2004 02:41 PM

<html:file> accept property and button's label
 
The statement:
- Using struts
- A <html:file> tag in a form

The issues:
/1/ accept
I'd like to limit the option of the browser filtering only the file *.jpg.
I though this should perform:
<html:file property="fileLoader" accept="*.jpg"/>
but not.

Could you tell me what's wrong?

/2/ label
Furthermore I could not set the label of the button.
<html:file property="fileLoader">Something</html:file>
neither perform.

It is possible to customise this button? How?

Sudsy 07-27-2004 07:14 PM

Re: <html:file> accept property and button's label
 
Smurf wrote:
<snip>
> /1/ accept
> I'd like to limit the option of the browser filtering only the file *.jpg.
> I though this should perform:
> <html:file property="fileLoader" accept="*.jpg"/>
> but not.
>
> Could you tell me what's wrong?


You have to read the javadocs vewwy, vewwy, cawefully...
Here's what it says about the accept attribute:
"Comma-delimited set of content types ..."
Note the use of the term 'content type'. What you provided
was a filename pattern, namely '*.jpg'.
Now if you go to the RFCs, namely RFC 2046, you'll find the
specification of content types. You'll also find that JPEG
maps to a content type of 'image/jpeg'. Try using that as
the value of the accept attribute.

HTH


Sudsy 07-28-2004 01:44 PM

Re: <html:file> accept property and button's label
 
Smurf wrote:
<snip>
> I also try
>
> <html:form method= "POST" enctype= "multipart/form-data"
> action="doSomething.do">
> ...
> <html:file property="fileLoader" accept="image/jpeg"/>
> ...
> </html>
> It also doesn't perform.


Apart from the spaces in the html:form tag (hopefully just
a transcription error), could you be more specific in how
it "doesn't perform"?
Do you get errors in your browser? Do you see internal
errors? Can you "View Page Source" and see that the tags
are recognized? Are you seeing the proper HTML?
Sorry, but without a bit more information I'd just be
taking shots in the dark. Do us both a favour and create
a self-contained example which is visible from the 'net.
(search the archives for Andrew's site)

ps. I KNOW that the approach I posted works since I use
it in a functional web application.


Smurf 07-28-2004 01:50 PM

Re: <html:file> accept property and button's label
 
the_little_smurf@yahoo.fr (Smurf) wrote in message news:<84d4e8a6.0407270641.3e02313d@posting.google. com>...
> The statement:
> - Using struts
> - A <html:file> tag in a form
>
> The issues:
> /1/ accept
> I'd like to limit the option of the browser filtering only the file *.jpg.
> I though this should perform:
> <html:file property="fileLoader" accept="*.jpg"/>
> but not.
>
> Could you tell me what's wrong?
>
> /2/ label
> Furthermore I could not set the label of the button.
> <html:file property="fileLoader">Something</html:file>
> neither perform.
>
> It is possible to customise this button? How?





I also try

<html:form method= "POST" enctype= "multipart/form-data"
action="doSomething.do">
...
<html:file property="fileLoader" accept="image/jpeg"/>
...
</html>
It also doesn't perform.


I try it in html:
<input type="file" name="fileLoader" accept="image/jpeg"/>
It neither performs.

In Microsoft document it's writen that the "accept" attribute is new
but not how new it is.
I run my work in IE 6.0, is this version already too old?
For struts, should I look for a struts-html.tld more up to date?

I'll be really gratefull if you could help me.
Thanks in advance

isoft 05-11-2012 03:06 PM

<input type="file" name="picture" id="picture" accept="image/*">

isoft 05-11-2012 03:27 PM

<input type="file" name="picture" accept="image/*">

Try this and it should work, this also filter jpg, png, bmp, and gif


All times are GMT. The time now is 08:58 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.