javascript - Multiple file upload. cloneNode of input fields with IE -
i want form uploads files server want transparent user. have input tag outside form cloned form clonenode() [javascript] every time user changes value. name of input tag "files[]". mozilla firefox clones input correctly ie doesn't copy value , ie inputs inside form empty. how can copy input field correctly ie?
a piece of code:
in javascript function called when input.onchange:
inputcopy = inputparent.childnodes[i].clonenode(true); document.getelementbyid('divfromform').appendchild(inputcopy);
the html input tag: <input type="file" id="archivoanadir" name="files[]" onchange="anadir(this.value)">
the php request:
foreach ($_files["files"]["name"] $key => $file) { $query = "..."; mysql_query($consulta) or die("..."); if (!is_uploaded_file( $_files["files"]["tmp_name"][$key] )) die("..."); if (!move_uploaded_file($_files["files"]["tmp_name"][$key], "media/" . $file)) die ("..." . $file); }
thanks.
edit: funnily enough, very same question asked week ago on so. comments in accepted answer provide explanation why can't done.
i pretty sure not working due security restriction, , rightly so.
in perception, ie tends more strict stuff this, maybe because they've been badly burned (and had such gaping security holes) in past.
you argue user did set value, , copying element should ok. kind of stuff doors cross-site-frame-something shenanigans (that work when frame in domain, frame b in that, user male , under thirty, , moon in virgo) made of, find understandable forbidden.
Comments
Post a Comment