How to change the "Browse" button text - html

I need to change the "Browse" button text according to the locale in a JSP. (Ex. Russian , Portuguese) for a Spring based project.
Following is the current implementation for the browse button
<td><input type="file" id="file" name="fileName"/></td>
As I know we can't change the text for input type file. It's the default behavior for a browse button int he browser.
I tried the following solution
<input type="button" id="button" value="Browse"/>
<input type="file" id="fileName" style="opacity:0; position:relative; left:-40px;" onchange="javascript: document.getElementById ('fileName').value = this.value"/>
But above one is giving security issue in the browser.
In https://stackoverflow.com/ it's having the ideal solution for this (change text for the browse button using input type file):
<input type="file" name="filename" id="filename-input" value="browse" size="18" style="float: right; width: 250px;">
Can anyone help me to resolve this problem or the way to implement above solution( https://stackoverflow.com/ file upload).

You might be looking for this answer to a similar question.
It suggests using Bootstrap File-system css styling.

suggest you to do it this way to keep it simple:
<input type="file" style="display:none"/>
<button id="browse">whatever</button>
$('#browse').click(function(){
$('input[type="file"]').trigger('click');
});

Related

How to localize Input File in HTML (Aurelia)?

I want to translate the text in input file through HTML (Aurelia). Here is the code:
<input type='file' id="choose-firmware-file" files.bind="selectedFirmwareFile"><br>
and the related image you can see here:
How to translate "Choose File" and "No file chosen" through HTML (Aurelia)??
okay, its no aurelia component, and an HTML Element, i think you need it:
<input type="file" id="fileInput" style="display:none;"/>
<label for="fileInput">Clique to file(This text needed change when file change event dispatch)</label>
I hope help you.

Drag and Drop file upload on a hidden <input type=file>

I am using this method below to hide the regular provided style and replace it with my own custom css (class="button") and now that I have done so, drag and dropping files no longer works, because the entire element is hidden.
Is there any work around to this preferably not using JavaScript?
<label class="button" for="file">
<input id="file" type="file" style="display:none;">
Browse
</label>

Mimic HTML form for uploading a picture

How do I mimic HTML form "Browse" and "Submit" buttons as done in facebook?
My form is:
<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
So far I can just do it in the traditional way. But what I really need is:
When the user clicks "Upload Picture" label or button or whatsoever, it mimics "Browse" button and on selecting a picture it mimics "Submit" button events. I don't want to show the odd looking browse and submit buttons...You got my point?
I've used PLUpload for something similar in the past. It is primarily for larger files, but it does the browsing and masking as you desire. I've even set up the JS to auto submit once the image is selected. It doesn't take much as long as you have the basic understanding of JS.
http://www.plupload.com/

input type file invisible on page load

I have this problem Only on IE7 and IE8.
I have a shadowbox that contains an input type file in it.
When this shadowbox is loaded, the input file is invisible... until I mouse hover it.
It's a reall basic form with a really basic input file:
<form action="" method="post" enctype="multipart/form-data" autocomplete="off">
<input type="file" name="img" onChange="$('#button_img').css('display','');" />
<input type="hidden" name="step_crop" value="1" />
<input type="submit" value="" />
</form>
I tried to delete everything on the file and only leave the form with one element which is, yeah, the evil input file, but still invisible on page load until I hover it.
Someone would have an idea ?
(Video link for the behavior: http://www.screenr.com/6ICH )
Please try to close your div and input tags properly. does it work?
Hi, I can see input field in both IE7 and IE8. Can you please add your view how it looks like before and after

HTML file selector(input type="file") button doesn't display correctly in chrome browser

I have a html file selector in index.php file.Code is given bellow
//index.php (This is just an example)
<form enctype="multipart/form-data" action="http://myserver/abc/upload.php" method="POST">
Select image to upload :
<input name="photo" type="file" size="30" width="250">
<input type="submit" value="Upload"/>
</form>
In firefox browser I can see file selector with a text field(which display the file path) and a button named 'Browse'(As a normal file selecting field)
But in chrome browser I can't see the text field.And button name is 'Chose file' not 'Browse'.
How can I fix this?
I need to display this in all browsers as it is display in firefox browser
there is no standard way of customizing file input style, but you can find a tons of css/js tricks. use keywords: custom css file input
Change your file type by adding this inline style
<input name="photo" type="file" size="30" width="250" style="line-height:0;">