Click here to Skip to main content
15,896,063 members
Home / Discussions / C#
   

C#

 
GeneralRe: c# procedure Pin
Dave Kreskowiak29-Aug-05 1:24
mveDave Kreskowiak29-Aug-05 1:24 
QuestionScrolling TreeView without scrollbars shown. Pin
Blazej Stompel26-Aug-05 9:44
Blazej Stompel26-Aug-05 9:44 
AnswerRe: Scrolling TreeView without scrollbars shown. Pin
Dave Kreskowiak26-Aug-05 14:17
mveDave Kreskowiak26-Aug-05 14:17 
QuestionMSDE 2000 over network Pin
Anonymous26-Aug-05 9:27
Anonymous26-Aug-05 9:27 
AnswerI'm not really anonymous Pin
theStorminMormon26-Aug-05 9:30
theStorminMormon26-Aug-05 9:30 
GeneralRe: I'm not really anonymous Pin
Alomgir Miah26-Aug-05 18:23
Alomgir Miah26-Aug-05 18:23 
QuestionCircle Image Pin
nc3b26-Aug-05 9:18
nc3b26-Aug-05 9:18 
QuestionForce user to submit excel file Pin
t2126-Aug-05 8:00
t2126-Aug-05 8:00 
OVERVIEW: When a user browses for a file it can choose and file extension. I want to limit this. So that if they choose say a jpg file it will say: " Sorry wrong ext. please submit an .xls file." I want to force the user to submit an excel file only. Any Clue will be help full.
I posted my code below.
Thank in advance



public class WebForm2 : System.Web.UI.Page
{
protected System.Web.UI.HtmlControls.HtmlInputFile inpFile;//Browse file
protected System.Web.UI.WebControls.Image imgPAIS;//PAIS image
protected System.Web.UI.HtmlControls.HtmlInputButton btnSubmit;//Submit button



private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent(); //Calls the sub-procedure

base.OnInit(e);
}

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.btnSubmit.ServerClick += new System.EventHandler(this.btnSubmit_ServerClick); //when btnSubmit Clicked
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion


private void btnSubmit_ServerClick(object sender, System.EventArgs e)// When btnSubmit Click follow sub-procedure
{


if( ( inpFile.PostedFile != null ) && ( inpFile.PostedFile.ContentLength > 0 ) )
{

string fn = System.IO.Path.GetFileName(inpFile.PostedFile.FileName);

//string procID = DateTime.Now.ToString("MMddHHmm");
string SaveLocation = Server.MapPath("Data") + "\\" + fn; //+ "NewUsers." + procID;//+ ".xls";


try
{
inpFile.PostedFile.SaveAs(SaveLocation);
Response.Write("Your file has been successfully submitted."); //Reads when file is done submitting
}
catch ( Exception ex )//If no file read
{

Response.Write("Error: " + ex.Message);
}
}
else
{

Response.Write("Please select a file to submit."); //Reads when no file selected
}
}
}
}
AnswerRe: Force user to submit excel file Pin
Daniel Turini26-Aug-05 9:04
Daniel Turini26-Aug-05 9:04 
GeneralRe: Force user to submit excel file Pin
t2126-Aug-05 11:15
t2126-Aug-05 11:15 
GeneralRe: Force user to submit excel file Pin
Daniel Turini26-Aug-05 15:27
Daniel Turini26-Aug-05 15:27 
QuestionFilter non-arabic unicode characters from a string Pin
Gulfraz Khan26-Aug-05 7:27
Gulfraz Khan26-Aug-05 7:27 
Questionbutton Pin
magnifique26-Aug-05 3:36
magnifique26-Aug-05 3:36 
AnswerRe: button Pin
Not Active26-Aug-05 3:40
mentorNot Active26-Aug-05 3:40 
GeneralRe: button Pin
Rikaino26-Aug-05 7:17
Rikaino26-Aug-05 7:17 
QuestionChannel sinks Pin
esjq26-Aug-05 2:51
esjq26-Aug-05 2:51 
AnswerRe: Channel sinks Pin
esjq30-Aug-05 21:48
esjq30-Aug-05 21:48 
QuestionWeb service problem Pin
26-Aug-05 2:49
suss26-Aug-05 2:49 
QuestionIs Shockwave Fash object in c# can help me to handle actions in flash? Pin
3DoorsDown26-Aug-05 2:33
3DoorsDown26-Aug-05 2:33 
AnswerRe: Is Shockwave Fash object in c# can help me to handle actions in flash? Pin
3DoorsDown26-Aug-05 2:40
3DoorsDown26-Aug-05 2:40 
GeneralRe: Is Shockwave Fash object in c# can help me to handle actions in flash? Pin
| Muhammad Waqas Butt |27-Aug-05 4:55
professional| Muhammad Waqas Butt |27-Aug-05 4:55 
GeneralRe: Is Shockwave Fash object in c# can help me to handle actions in flash? Pin
3DoorsDown27-Aug-05 20:29
3DoorsDown27-Aug-05 20:29 
QuestionTranslate DLL (C++ 6.0 to C#.NET) Pin
gr196726-Aug-05 2:09
gr196726-Aug-05 2:09 
AnswerRe: Translate DLL (C++ 6.0 to C#.NET) Pin
Daniel Turini26-Aug-05 2:17
Daniel Turini26-Aug-05 2:17 
AnswerRe: Translate DLL (C++ 6.0 to C#.NET) Pin
Andrew Kirillov26-Aug-05 2:28
Andrew Kirillov26-Aug-05 2:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.