Hello Jctech2025, thank you for posting in the Microsoft Q&A community.
This behavior is completely expected based on your current HTML code. The issue is occurring because your form's action attribute is pointing directly to a folder directory (http://siteaddres:portnumber/Uploadfolder). By default, IIS does not know how to handle an HTTP POST request sent directly to a physical or virtual folder. An HTML form simply packages the file and sends it over the network, but IIS requires a server-side application (such as ASP.NET, PHP, Python, etc.) to actively receive that package, parse it, and write it to your hard drive.
To resolve this, we need to introduce a server-side handler to receive the POST request and ensure your IIS permissions are correctly configured to allow saving the file.
First, update your HTML form so the action points to a server-side script endpoint instead of a folder.
Next, you will need to create the Upload.aspx script in your website's root directory to process the upload. Here is an ASP.NET C# example that receives the file and securely saves it into upload folder:
<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Files.Count > 0)
{
try
{
var file = Request.Files[0];
if (file != null && file.ContentLength > 0)
{
string fileName = Path.GetFileName(file.FileName);
// Map the virtual path to the physical disk path
string savePath = Server.MapPath("~/Uploadfolder/") + fileName;
file.SaveAs(savePath);
Response.Write("File uploaded successfully.");
}
}
catch (Exception ex)
{
Response.Write("Error: " + ex.Message);
}
}
}
</script>
As a final step, IIS needs permission to write to your destination folder. By default, IIS runs websites under an application pool identity that only has "Read" access to protect your system.
- Open File Explorer and navigate to the physical path of your website.
- Right-click your Uploadfolder, select Properties, and go to the Security tab.
- Click Edit, then click Add.
- Type IIS_IUSRS in the object names box.
- Click Check Names and then click OK.
- Select the newly added IIS_IUSRS group from the list, and check the Modify box under the Allow column.
- Click Apply and OK.
If you are using a different web framework (like PHP or Node.js) instead of ASP.NET, please let me know your specific environment. Alternatively, to help us isolate the issue further, please check your IIS Logs located at %SystemDrive%\inetpub\logs\LogFiles and share the exact HTTP status code (e.g., 405 Method Not Allowed) generated when you click Upload.
I will follow up on this thread to ensure your issue is resolved. If the guidance provided helped you navigate to this solution, please consider clicking 'Accept answer'. This officially marks the thread as answered and greatly helps other community members who are searching for a solution to this exact same problem.