I've an html file with the below markup:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Upload Page</title>
</head>
<body>
<form id="frmUpload" action="UploadHandler.ashx" method="post" enctype="multipart/form-data">
<input type="file" /><br />
<br />
<input id="Submit1" type="submit" value="Submit" />
</form>
</body>
</html>
I have a handler (ashx) file to handle the upload which goes like this:
<%@ WebHandler Language="VB" Class="UploadHandler" %>
Imports System
Imports System.Web
Imports System.Diagnostics
Public Class UploadHandler : Implements IHttpHandler
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim str As String
str = "EncType = " & context.Request.ContentType
str &= vbCrLf
str &= "File Count = " & context.Request.Files.Count
context.Response.ContentType = "text/plain"
context.Response.Write(str)
End Sub
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
End Class
When I am working with the html page, I select a file and do a submit, I get a response like this:
EncType = multipart/form-data; boundary=---------------------------7d9232a130656
File Count = 0
I was expecting the file count to be 1 here but it is 0...what is wrong?