https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 8aa53dd361f53703c6c67c4b007a472832a855a2 authored by Marcos Cáceres on 22 November 2018, 02:14:30 UTC
fix: copy pasta
Tip revision: 8aa53dd
submit-file.sub.html
<!DOCTYPE html>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<iframe id=testframe name=testframe></iframe>
<form id=testform method=post action="//{{domains[www1]}}:{{location[port]}}/html/semantics/forms/form-submission-0/resources/file-submission.py" target=testframe enctype="multipart/form-data">
<input name=testinput id=testinput type=file>
</form>
<script>
async_test(t => {
  const dataTransfer = new DataTransfer();
  dataTransfer.items.add(new File(["foobar"], "name"));
  assert_equals(1, dataTransfer.files.length);

  testinput.files = dataTransfer.files;
  testform.submit();

  onmessage = e => {
    if (e.source !== testframe) return;
    assert_equals("FieldStorage('testinput', 'name', 'foobar')", e.data);
    t.done();
  };
}, 'Posting a File');
</script>
back to top