Uploading a File Using PowerShell ASP

PowerShell ASP works in much the same way that ASP.NET would. Uploading a file to the server from a webpage is no different. Below is an example showing how to allow the user to upload a file to the server:

        <link href="stylesheet.css" rel="stylesheet" type="text/css"></link>
        if($Request.RequestType -eq "POST")
          $file = $Request.Files["myFile"] 
          Write-Host "$($file.FileName) uploaded."
        { %>
        <form id="form1" method="POST" enctype="multipart/form-data">
          <input type="file" id="myFile" name="myFile" />
          <button type="submit" form="form1" value="submit">Submit</button>

We appreciate your feedback.  If you have any questions, comments, or suggestions about this article please contact our support team at kb@nsoftware.com.