blob: 9d184b14b6727039e18d146b350e95e4a47bd60f [file]
<!DOCTYPE html>
<!-- This page has a form that submits to the "target" param of the search part
of this page's URL. For example if this page's URL is
"form.html?target=//example.com/upload", the form submits to
//example.com/upload.
-->
<meta charset="utf-8">
<head>
<title>form</title>
</head>
<form id="form" method="POST" enctype="multipart/form-data">
<input id="text1" type="text" name="text1" value="textValue1">
<input id="text2" type="text" name="text2" value="textValue2">
<input id="file" type="file" name="file">
</form>
<script>
const fileInput = document.querySelector('#file');
const form = document.querySelector('#form');
// Set the form to submit to the |target| param.
const documentUrl = new URL(window.location);
form.action = documentUrl.searchParams.get('target');
</script>