Error when I try to use SaveAs()

Jul 27, 2010 at 6:14 PM

This line produce the error:  "FileUploaderAJAX1.SaveAs(saveDir, pf.FileName);"

 

Error description: "Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index"

My method:

 

private void managePost()
{
HttpPostedFileAJAX pf = FileUploaderAJAX1.PostedFile;

string saveDir = "~/Uploads";

if (pf.Type == HttpPostedFileAJAX.fileType.zip && pf.ContentLength <= ((5 * 1024) * 1024))
FileUploaderAJAX1.SaveAs(saveDir, pf.FileName);
ChargeInfo();
}

Please help me!