Uploading a File to a Script Page |
Active Web |
The following script code displays the contents of the request object; it also shows how to detect and display uploaded file page parameters:
<h1>Current Request Variables</h1>
<table>
<script runat="server">
for (i in request) {
if (request[i].size != null) {
writeln("<tr><td>request."+i+"</td><td><table>");
var file = request[i];
for (j in file) {
writeln("<tr><td>"+i+"."+j+"</td><td>"+file[j]+"</td></tr>");
}
writeln("</table></td></tr>");
}
else {
writeln("<tr><td>request."+i+"</td><td>"+request[i]+"</td></tr>");
}
}
</script>
</table>
<table>
<form method=post action=uploadexample.xsp enctype="multipart/form-data">
<tr><td>Field1</td><td><input type=text name=field1></td></tr>
<tr><td>MyFile</td><td><input type=file name=myfile></td></tr>
<tr><td colspan=2><input type=submit></td></tr>
</form>
</table>
Topic ID: 150110