IE cannot send file download when it is hidden for styling purposes

Well, I'm pretty stuck, so I'm opening up another question about styling a file-fileupload form element.

After some attempts, I finally (thought) that I succeeded, but then, as usual, IE will again begin to protest. The fact is that I will have the following form: it hides the real input file with css and replaces it with a fake one using the fileHiddenInput div file.

HTML:

<form enctype="multipart/form-data" method="post" name="uploadform" action = ""> <div class="input-append"> <input type="text" id = "appendedInputButtons" class="span2" name="fileuploadtext"><input type="button" id="upbutton" class="btn" value="Select"><input type="submit" name="upload" value="uploaden" class="btn"> </div> **<div class="fileHiddenInput"><input id="upfile" type="file" name="file" value="upload" /></div>** </form> 

CSS

 /** file input **/ .fileHiddenInput { height: 0px; width: 0px; overflow:hidden; } 

I will use some jquery to submit the form, I can post this code here as well. But after many trial and error, I find out that IE9 will not send the input file for so long if it hides the input file with css using the file div. When make, I will make the file input view visible by deleting the fileHiddenInput div or making it visible with css, then the form will simply receive send, as it should.

Does anyone know or has anyone found a workaround?

+4
source share
2 answers

You can try several concealment strategies, one of them by placing an element from the screen, setting the style, for example

 position: absolute; z-index: 19999; top: -1000px; left: -1000px; 

Another way would be to hide the file input control with an opaque control.

+2
source

Opacity 0 for the element made it consider hidden.

Hope this can help someone - I had a problem getting the file_field.set file to work with IE and selenium / watir. The problem was that (: input => "upload") was under the anchor tag. When we looked at it through the inspector, we saw that the opacity of the file field below it was set to 0 .., which caused an element error that was not displayed.

Setting the opacity to> 0 (0.01 worked in our case) allowed the web driver to interact with it and generate a download window and set the path to the file.

It was testing on Win7 with IE11

0
source

All Articles