bthumber
6/21/2010 11:04:00 PM
Specifed argument was out of range of valid values. Parameter name: i
Please my code:
Specified argement was out of range of valid values. Parameter name i:
That was my error please see the code below:
view plaincopy to clipboardprint?
if (FileUpload1.HasFile)
{
string filepath = FileUpload1.PostFile.FileName;
string pat = @"\\(?:.+) \\ (.+) \. (.+)";
Regex r = new Regex(pat);
// run
Match m = r.Match(filepath);
string file_ext = m.Group[2].Captures[0].ToString(); // error on this
line
string filename = m.Group[1].Captures[0].ToString();
string file = filename + "." + file_ext;
}
if (FileUpload1.HasFile)
{
string filepath = FileUpload1.PostFile.FileName;
string pat = @"\\(?:.+) \\ (.+) \. (.+)";
Regex r = new Regex(pat);
// run
Match m = r.Match(filepath);
string file_ext = m.Group[2].Captures[0].ToString(); // error on this line
string filename = m.Group[1].Captures[0].ToString();
string file = filename + "." + file_ext;
}
What is causing the error and how do I fix it?