[Webkit-unassigned] [Bug 28123] WebKit could not copy the form with this parameter in the iframe

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 10 18:51:44 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=28123





--- Comment #2 from Mikhail <mikhail.v.gavrilov at gmail.com>  2009-08-10 18:51:43 PDT ---
Please create two files:

index.html

<html>
<head>
<script language="javascript"> 

function init() {
    var formObj = document.getElementById('fff');
    formObj.onclick = ajaxsubmit;
}

function createIFrame() {
  var id = 'f' + Math.floor(Math.random() * 99999);
  var div = document.createElement('div');
  div.innerHTML = '<iframe  src="about:blank" id="'+id+'" name="'+id+'"
onload="sendComplete(this)"></iframe>';
  document.body.appendChild(div);
'idElement' );
  return document.getElementById(id);
}


function AJAXRequest(url, param, formObj) {
    var iframe = createIFrame();      
    formObj.target = iframe.id;
    alert('Запрос 1 готов');
}

function AJAXRequest2(url, param, formObj) {
    var iframe = createIFrame();         
).contentWindow.document.getElementById( 'idElement' )
    var idocument = iframe.contentWindow.document;
    var iform = idocument.importNode(formObj, true);
    var ibody = idocument.getElementsByTagName("body")[0];
    ibody.appendChild(iform);
    alert('Запрос 2 готов');
    idocument.getElementById('ttt').click();
}


function ajaxsubmit(event) { 
    event = event || window.event;
    var oSubmit = event.target || event.srcElement;
    if (oSubmit.type != 'submit') return;
//    window.location.hash = this.action.replace(/^.*?\?/,'#');
    if (oSubmit.name == 'submit1')
      AJAXRequest(this.action, oSubmit.name + "=" + encodeURI(oSubmit.value),
this);
    else {
      AJAXRequest2(this.action, oSubmit.name + "=" + encodeURI(oSubmit.value),
this);
      return false;
    }
};  

function killform() { 
    var divObj = document.getElementById('ccc');
    divObj.innerHTML = 'Все!';
}

</script>
</head>
<body onload = "init()">
<div id="ccc">
<form id="fff" name="myForm" action="upload.php" method="post"
enctype="multipart/form-data">
<input type='file' name='file'/>
<input type='text' name='text' value='test string'/>
<input id='tt1' type='submit' name='submit1' value='upload method 1'/>
<input id='ttt' type='submit' name='submit2' value='upload method 2'/>
</form>
</div>
<input type="button" value="Kill form" onclick="killform();"/>
</body>
</html>

and upload.php

<?php
  print_r($_FILES);
  print_r($_POST);
?>

When used 'upload method 2' parameter tag "input type='file'" not imported to
iframe. In Opera and Mozilla both method worked.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list