I Have a problem with my project ,
I have to upload file excel into server ,
but before upload file ,i want to recheck and validate the file using
eppplus ,
And i think i need to get the file path to validate it using epp,
how can i solve this ?
What I have tried:
This is my code ,
In my aspx file
<dd style="text-align:left">
<asp:fileupload id="FileUpload1" runat="server" width="90%" onchange="callme()"></asp:fileupload>
<asp:RegularExpressionValidator
id="FileUpLoadValidator" runat="server"
ErrorMessage="Upload Jpegs and Gifs only."
ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.xls|.xlsx)$"
ControlToValidate="FileUpload1">
</asp:RegularExpressionValidator>
<pre> <asp:Button ID="btncheck" OnClick="uploadfile" runat="server" Text="Cancel" CssClass="btn btn-primary"/>
this in on aspx.cs
protected void uploadfile(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
string path = Server.MapPath("~/");
string a = FileUpload1.PostedFile.InputStream.ToString();
string fileexcel = FileUpload1.PostedFile.FileName;
txtSchedule.Text = FileUpload1.PostedFile.FileName;
string Path = HttpContext.Current.Request.PhysicalApplicationPath + FileUpload1.FileName;
label1.Text = fileexcel;
}
}