src/javascript/runtime/html4/file/FileInput.js
function addInput() {
			var comp = this, I = comp.getRuntime(), shimContainer, browseButton, currForm, form, input, uid;

			uid = Basic.guid('uid_');

			shimContainer = I.getShimContainer(); // we get new ref every time to avoid memory leaks in IE

			if (_uid) { // move previous form out of the view
				currForm = Dom.get(_uid + '_form');
				if (currForm) {
					Basic.extend(currForm.style, { top: '100%' });
					// it shouldn't be possible to tab into the hidden element
					currForm.firstChild.setAttribute('tabindex', -1);
				}
			}

			// build form in DOM, since innerHTML version not able to submit file for some reason
			form = document.createElement('form');
			form.setAttribute('id', uid + '_form');
			form.setAttribute('method', 'post');
			form.setAttribute('enctype', 'multipart/form-data');
			form.setAttribute('encoding', 'multipart/form-data');

			Basic.extend(form.style, {
				overflow: 'hidden',
				position: 'absolute',
				top: 0,
				left: 0,
				width: '100%',
				height: '100%'
			});

			input = document.createElement('input');
			input.setAttribute('id', uid);
			input.setAttribute('type', 'file');
			input.setAttribute('accept', _mimes.join(','));

			if (I.can('summon_file_dialog')) {
				input.setAttribute('tabindex', -1);
			}

			Basic.extend(input.style, {
				fontSize: '999px',
				opacity: 0
			});

			form.appendChild(input);
			shimContainer.appendChild(form);

			// prepare file input to be placed underneath the browse_button element
			Basic.extend(input.style, {
				position: 'absolute',
				top: 0,
				left: 0,
				width: '100%',
				height: '100%'
			});

			if (Env.browser === 'IE' && Env.verComp(Env.version, 10, '<')) {
				Basic.extend(input.style, {
					filter : "progid:DXImageTransform.Microsoft.Alpha(opacity=0)"
				});
			}

			input.onchange = function() { // there should be only one handler for this
				var file;

				if (!this.value) {
					return;
				}

				if (this.files) { // check if browser is fresh enough
					file = this.files[0];
				} else {
					file = {
						name: this.value
					};
				}

				file = new File(I.uid, file);

				// clear event handler
				this.onchange = function() {}; 
				addInput.call(comp); 

				comp.files = [file];

				// substitute all ids with file uids (consider file.uid read-only - we cannot do it the other way around)
				input.setAttribute('id', file.uid);
				form.setAttribute('id', file.uid + '_form');
				
				comp.trigger('change');

				input = form = null;
			};


			// route click event to the input
			if (I.can('summon_file_dialog')) {
				browseButton = Dom.get(_options.browse_button);
				Events.removeEvent(browseButton, 'click', comp.uid);
				Events.addEvent(browseButton, 'click', function(e) {
					if (input && !input.disabled) { // for some reason FF (up to 8.0.1 so far) lets to click disabled input[type=file]
						input.click();
					}
					e.preventDefault();
				}, comp.uid);
			}

			_uid = uid;

			shimContainer = currForm = browseButton = null;
		}
function addInput() {
			var comp = this, I = comp.getRuntime(), shimContainer, browseButton, currForm, form, input, uid;

			uid = Basic.guid('uid_');

			shimContainer = I.getShimContainer(); // we get new ref every time to avoid memory leaks in IE

			if (_uid) { // move previous form out of the view
				currForm = Dom.get(_uid + '_form');
				if (currForm) {
					Basic.extend(currForm.style, { top: '100%' });
					// it shouldn't be possible to tab into the hidden element
					currForm.firstChild.setAttribute('tabindex', -1);
				}
			}

			// build form in DOM, since innerHTML version not able to submit file for some reason
			form = document.createElement('form');
			form.setAttribute('id', uid + '_form');
			form.setAttribute('method', 'post');
			form.setAttribute('enctype', 'multipart/form-data');
			form.setAttribute('encoding', 'multipart/form-data');

			Basic.extend(form.style, {
				overflow: 'hidden',
				position: 'absolute',
				top: 0,
				left: 0,
				width: '100%',
				height: '100%'
			});

			input = document.createElement('input');
			input.setAttribute('id', uid);
			input.setAttribute('type', 'file');
			input.setAttribute('accept', _mimes.join(','));

			if (I.can('summon_file_dialog')) {
				input.setAttribute('tabindex', -1);
			}

			Basic.extend(input.style, {
				fontSize: '999px',
				opacity: 0
			});

			form.appendChild(input);
			shimContainer.appendChild(form);

			// prepare file input to be placed underneath the browse_button element
			Basic.extend(input.style, {
				position: 'absolute',
				top: 0,
				left: 0,
				width: '100%',
				height: '100%'
			});

			if (Env.browser === 'IE' && Env.verComp(Env.version, 10, '<')) {
				Basic.extend(input.style, {
					filter : "progid:DXImageTransform.Microsoft.Alpha(opacity=0)"
				});
			}

			input.onchange = function() { // there should be only one handler for this
				var file;

				if (!this.value) {
					return;
				}

				if (this.files) { // check if browser is fresh enough
					file = this.files[0];
				} else {
					file = {
						name: this.value
					};
				}

				file = new File(I.uid, file);

				// clear event handler
				this.onchange = function() {}; 
				addInput.call(comp); 

				comp.files = [file];

				// substitute all ids with file uids (consider file.uid read-only - we cannot do it the other way around)
				input.setAttribute('id', file.uid);
				form.setAttribute('id', file.uid + '_form');
				
				comp.trigger('change');

				input = form = null;
			};


			// route click event to the input
			if (I.can('summon_file_dialog')) {
				browseButton = Dom.get(_options.browse_button);
				Events.removeEvent(browseButton, 'click', comp.uid);
				Events.addEvent(browseButton, 'click', function(e) {
					if (input && !input.disabled) { // for some reason FF (up to 8.0.1 so far) lets to click disabled input[type=file]
						input.click();
					}
					e.preventDefault();
				}, comp.uid);
			}

			_uid = uid;

			shimContainer = currForm = browseButton = null;
		}
function addInput ( ) { var comp = this , I = comp . getRuntime ( ) , shimContainer , browseButton , currForm , form , input , uid ; uid = Basic . guid ( 'uid_' ) ; shimContainer = I . getShimContainer ( ) ; // we get new ref every time to avoid memory leaks in IE if ( _uid ) { // move previous form out of the view currForm = Dom . get ( _uid + '_form' ) ; if ( currForm ) { Basic . extend ( currForm . style , { top : '100%' } ) ; // it shouldn't be possible to tab into the hidden element currForm . firstChild . setAttribute ( 'tabindex' , - 1 ) ; } } // build form in DOM, since innerHTML version not able to submit file for some reason form = document . createElement ( 'form' ) ; form . setAttribute ( 'id' , uid + '_form' ) ; form . setAttribute ( 'method' , 'post' ) ; form . setAttribute ( 'enctype' , 'multipart/form-data' ) ; form . setAttribute ( 'encoding' , 'multipart/form-data' ) ; Basic . extend ( form . style , { overflow : 'hidden' , position : 'absolute' , top : 0 , left : 0 , width : '100%' , height : '100%' } ) ; input = document . createElement ( 'input' ) ; input . setAttribute ( 'id' , uid ) ; input . setAttribute ( 'type' , 'file' ) ; input . setAttribute ( 'accept' , _mimes . join ( ',' ) ) ; if ( I . can ( 'summon_file_dialog' ) ) { input . setAttribute ( 'tabindex' , - 1 ) ; } Basic . extend ( input . style , { fontSize : '999px' , opacity : 0 } ) ; form . appendChild ( input ) ; shimContainer . appendChild ( form ) ; // prepare file input to be placed underneath the browse_button element Basic . extend ( input . style , { position : 'absolute' , top : 0 , left : 0 , width : '100%' , height : '100%' } ) ; if ( Env . browser === 'IE' && Env . verComp ( Env . version , 10 , '<' ) ) { Basic . extend ( input . style , { filter : "progid:DXImageTransform.Microsoft.Alpha(opacity=0)" } ) ; } input . onchange = function ( ) { // there should be only one handler for this var file ; if ( ! this . value ) { return ; } if ( this . files ) { // check if browser is fresh enough file = this . files [ 0 ] ; } else { file = { name : this . value } ; } file = new File ( I . uid , file ) ; // clear event handler this . onchange = function ( ) { } ; addInput . call ( comp ) ; comp . files = [ file ] ; // substitute all ids with file uids (consider file.uid read-only - we cannot do it the other way around) input . setAttribute ( 'id' , file . uid ) ; form . setAttribute ( 'id' , file . uid + '_form' ) ; comp . trigger ( 'change' ) ; input = form = null ; } ; // route click event to the input if ( I . can ( 'summon_file_dialog' ) ) { browseButton = Dom . get ( _options . browse_button ) ; Events . removeEvent ( browseButton , 'click' , comp . uid ) ; Events . addEvent ( browseButton , 'click' , function ( e ) { if ( input && ! input . disabled ) { // for some reason FF (up to 8.0.1 so far) lets to click disabled input[type=file] input . click ( ) ; } e . preventDefault ( ) ; } , comp . uid ) ; } _uid = uid ; shimContainer = currForm = browseButton = null ; }
save original z-index;
save original z - index ;