How to style a file upload? - html

In firefox it looks like a text field that you click on and i just need a button like safari renders..Is there a way to not display the text field looking file upload in firefox

Asked many times before:
How can I style a file input field in Firefox?
Styling an input type="file" button
How to style "input file" with CSS3 / Javascript?
https://stackoverflow.com/questions/3984815/jquery-best-way-to-style-a-input-file-tag
Can we change <input type="file"> style?
Style of input=File as a button

Related

"for" attribute not working inside button for Firefox

I want to customize the input element by changing the text to "Choose file ..." and hide the file's name. Also if a user click the button a window is opened for user to choose file. The code is
<button>
<label for="upload"> Choose file ... </label>
</button>
<input type="file" id="upload" style="display:none">
With Chrome, if I click the button a window is popped up for me to choose the file. However it doesn't work with Firefox and IE. Do you know how can I make it work for all three browsers? Thank you.
The label tag does not work for buttons. It is by and large used with radio buttons. The below should do what you are looking for:
<button id="btnFile" onclick="upload.click();">
Choose file ...
</button>
<input type="file" id="upload" style="display:none">
Your HTML is invalid. A label cannot be a descendant of a button.
Remove the button:
<label for="upload"> Choose file ... </label>
<input type="file" id="upload" style="display:none">
(Tested in Firefox. I don't have a copy of IE to hand.)
If you want something that looks like a button, then style it that way with CSS.

File upload css issue

I want to have a file upload using php. my problem simple in the CSS I make:
<input name="ufile" type="file" id="ufile" size="50" />
it just show the browse button.
I want to have like a text box with the browse button to show the file address after upload it.
I know that :
<input name="ufile" type="file" id="ufile" size="50" />
will show the text box as will as the browse button but I tried it on firefox and chrome nothing showed just the button not text box. does anybody have any idea about that? why the text box is not shown???
I've tested your html above and it worked in Firefox and IE 9. My guess is that you have some CSS within your webpage that is affecting the file input. You could try use Firebug of developer tools in Chrome to inspect the input to see what css rules are being applied.

How to make a html speech button

So am trying to make an html5 speech button
i want something like that button in Google translate website
http://translate.google.com if you visited the website in chrome you will find a speech to text input the one that Google offers with chrome browsers
so i took a look at the HTML code and i found this
<input id="gt-speech-in" type="text" speech="speech" x-webkit-speech="x-webkit-speech"
x-webkit-grammar="builtin:translate" size="1" lang="en" style="" tabindex="-3">
which does not output a button like it was in translate.google it just outputs a small text input
so how can a change it into a button or make it smaller so it can look like a button?
In Chrome the snippet above does display the input microphone, and you can control the size of the text entry field in the style eg:
<input id="gt-speech-in" type="text" speech="speech" x-webkit-speech="x-webkit-speech"
x-webkit-grammar="builtin:translate" size="1" lang="en" style="width:200px;" tabindex="-3">
Are you trying to get anythng additional to display on the form (or get it to work in a non-Chrome environment)?

code for submit button works in ff but not in ie

the following code works in FF, but it does not work in IE8.
<a class="sub">
<input type="submit" a="" none;<="" display:="">
</a>
The button is displayed, but the button is not clickable in IE8. What is going on?
Here is a correctly formed input submit button:
<input type="submit" value="Submit">
I noticed the words display and none usually you'd find it in the following form:
<input type="submit" value="Submit" style="display:none;"> // this however will hide the button
The attribute of type= with the value of "submit" makes our input tag into a submit button.
The attribute of value= with the value of "Submit" displays "Submit" text on our input button.
The attribute of style= allows us to do some inline css like "display:none;" which hides a html element its declared on.
I recommend checking out W3Schools for more on html input tags.
Additionally you are trying to make the button into a link using the <a> tag, this is invalid, please take a look at this Html forms and input page to see how to use the submit input type.
If you just want a link then I'd recommend looking at an <img> for a button and an <a> tag around that.
I do not have comment privileges on this SE yet but I would say that IE is incapable if interpreting: <input type="submit" a="" none;<="" display:="">
When you open "input" you do not close it until after display. the addition of the "none;<" is probably interpreted as another attempt at a tag and breaking html. I'm not sure what you are trying to accomplish but get rid of this:
none;<=""
The code is a mess, but it actually works in IE8, so any problem you are seeing is caused by something outside the code you posted.
Browsers will ignore the crap inside the input tag and recognize it simply as <input type="submit">. Some browsers might conceivably choke on the “<” character there, but IE8 doesn’t.
The a element wrapper outside it has no effect as such.

changing the name of type="file" input tag?

i have an input tag...
<input type="file" name="upload">
for browsing it makes the button vith value "browse"(in mozilla)
the question is: how can i change the name of that button? i want it to have the name "select" instead of "browse".
Thanks
Unfortunately the button text of an <input type="file"> is controlled by the browser, and cannot be changed, as far as I know.
In general, fancy file uploaders are often flash-based. However, if you are ready for a challenge, you may want to check out the following QuirksMode article for a few CSS + JavaScript tricks in this direction:
QuirksMode: Styling an input type="file"
I haven't tried, but can you set the input to display:none and then use background images?