No, I needed the correct enctype attribute in my <FORM> tag...whoops! :D
> I've been trying to upload files with the HtmlInputFile control,
a> nd I keep getting an "Object reference not set to an
i> nstance of an object." error, when calling
U> serFile.PostedFile.SaveAs()...code is as follows:
>
<> INPUT id="UserFile" type="file" runat="server">
> (and later...)
> <input class="InputButton" id="btnUpload2" type="submit" value="Upload"
r> unat="server">
> In my codebehind, I have the following:
> this.btnUpload2.ServerClick += new System.EventHandler
(> this.btnUpload2_ServerClick);
> private void btnUpload2_ServerClick(object sender, System.EventArgs e)
{>
i> f(!ValidatePage())
r> eturn;
s> tring UploadPath = strServerPath + @"\Uploads\" +
U> serID.ToString() + @"\";
i> f(!Directory.Exists(UploadPath))
{>
D> irectory.CreateDirectory(UploadPath);
}>
s> tring strClPath = UserFile.Value;
s> tring strFileName = strClPath.Substring((strClPath.LastIndexOf(@"\")
+1));
U> ploadPath += strFileName;
U> serFile.PostedFile.SaveAs(UploadPath);
}>
> Anyone have any suggestions? Thanks...
> Jonas