DallasAggie
Programmer
Hey all!
I have a simple upload utility that will post files to our web server --- from there, the file then gets uploaded into Crystal Enterprise.
Since we only want to post .rpt files (Crystal Reports), I had code to validate the file
This seemed to work fine on my development machine, but when I tried it remotely (from a machine that doesn't have .rpt files registered), it would read .rpt files as "application/octet-stream" ... thus causing it to fail.
My question is: Is there a different way to validate the file type? I tried using Regular Expression Validator with this expression:
...as suggested by Microsoft: ... but that doesn't seem to help. Actually, it doesn't even throw an error ... Maybe the expression is wrong?
Any..and ALL suggestion/advice is welcomed
Thanks,
DallasAggie
I have a simple upload utility that will post files to our web server --- from there, the file then gets uploaded into Crystal Enterprise.
Since we only want to post .rpt files (Crystal Reports), I had code to validate the file
Code:
string fileType = cr_File_reportBrowse.PostedFile.ContentType.ToString();
if (fileType != "application/x-rpt")
{
cr_File_reportBrowse.Dispose();
cr_lbl_Messages.Text = "You must select a file of type Crystal Reports. You attempted to upload a file of type " + fileType;
}
This seemed to work fine on my development machine, but when I tried it remotely (from a machine that doesn't have .rpt files registered), it would read .rpt files as "application/octet-stream" ... thus causing it to fail.
My question is: Is there a different way to validate the file type? I tried using Regular Expression Validator with this expression:
Code:
^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.rpt|.RPT)$
...as suggested by Microsoft: ... but that doesn't seem to help. Actually, it doesn't even throw an error ... Maybe the expression is wrong?
Any..and ALL suggestion/advice is welcomed
Thanks,
DallasAggie