Click here to Skip to main content
15,844,602 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionImage locking Pin
Dholakiya Ankit19-Sep-13 19:26
Dholakiya Ankit19-Sep-13 19:26 
AnswerRe: Image locking Pin
Bernhard Hiller19-Sep-13 22:35
Bernhard Hiller19-Sep-13 22:35 
GeneralRe: Image locking Pin
Dholakiya Ankit19-Sep-13 23:35
Dholakiya Ankit19-Sep-13 23:35 
AnswerRe: Image locking Pin
David Mujica20-Sep-13 3:20
David Mujica20-Sep-13 3:20 
GeneralRe: Image locking Pin
Dholakiya Ankit20-Sep-13 3:24
Dholakiya Ankit20-Sep-13 3:24 
QuestionDisplay images from server folder Pin
SAM_India19-Sep-13 9:20
SAM_India19-Sep-13 9:20 
AnswerRe: Display images from server folder Pin
jkirkerx19-Sep-13 14:20
professionaljkirkerx19-Sep-13 14:20 
AnswerRe: Display images from server folder Pin
Pratik Bhuva24-Sep-13 22:21
professionalPratik Bhuva24-Sep-13 22:21 
Code To upload Your Image to folder

C#
YourFunctionToUploadImage()
{
  //Check FileUpload controll has File Or not
  if (ImageFileUploadControll.HasFile)
  { 
         string fileExtention = System.IO.Path.GetExtension(ImageFileUploadControll.FileName);
         //Check For Valid Extension
            if (fileExtention.ToLower() != ".jpg" && fileExtention.ToLower() != ".jpeg" && fileExtention.ToLower() != ".png")
            {
                lblUploadstatus.Text = "Invalid File Choose .jpg/.jpeg/.png/.gif";
            }
            else
            {
                    //check if file already Exists in Folder
                    if (File.Exists(Server.MapPath("~/Folder_Name/" + ImageFileUploadControll.FileName)))
                    {
                        lblUploadstatus.Text = "File Already Exists. Rename filename";
                    }
                    else
                    {
                        //To Save Image To your Specific Location.
                        //srever.mappath takes us to Folder which containing our application
                        ImageFileUploadControll.SaveAs(Server.MapPath("~/Folder_Name/" + ImageFileUploadControll.FileName));
                        lblUploadstatus.Text = "Upload Status : File Uploaded Successfully";
                    } 
            }
            
   }
   else 
   {
      lblUploadstatus.Text = "Please Select File";
   }
}


Code To Retrive Images form Folder

C#
PageLoadEvent()
{
    //use DirectoryInfo to get all imageFile's Information
    DirectoryInfo dir = new DirectoryInfo(Server.MapPath("~/Folder_Name/"));
    FileInfo[] fi = dir.GetFiles();

    //Now you just need to create new image control each time and add ImageUrl to it
    foreach(FileInfo f in fi)
    {
         string imageUrl = f.ToString();
         Image img = new Image();
         img.ImageUrl = "~/Folder_Name/"+"imageUrl";
    }
}


Hope This Help
Pratik M. Bhuva

GeneralRe: Display images from server folder Pin
SAM_India1-Oct-13 15:54
SAM_India1-Oct-13 15:54 
GeneralRe: Display images from server folder Pin
Pratik Bhuva5-Oct-13 0:17
professionalPratik Bhuva5-Oct-13 0:17 
AnswerRe: Display images from server folder Pin
Vishnu Prajapati24-Sep-13 23:38
professionalVishnu Prajapati24-Sep-13 23:38 
QuestionI need a free hosting for asp.net with sql server, is it possible? Pin
Member 1028433219-Sep-13 1:51
Member 1028433219-Sep-13 1:51 
AnswerRe: I need a free hosting for asp.net with sql server, is it possible? Pin
hypermellow19-Sep-13 2:17
professionalhypermellow19-Sep-13 2:17 
AnswerRe: I need a free hosting for asp.net with sql server, is it possible? Pin
David C# Hobbyist.19-Sep-13 8:36
professionalDavid C# Hobbyist.19-Sep-13 8:36 
AnswerRe: I need a free hosting for asp.net with sql server, is it possible? Pin
mastanp22-Sep-13 7:06
mastanp22-Sep-13 7:06 
QuestionOnline Backup in asp .net Pin
Vicky_Aryan18-Sep-13 21:01
Vicky_Aryan18-Sep-13 21:01 
AnswerRe: Online Backup in asp .net Pin
Richard MacCutchan18-Sep-13 22:01
mveRichard MacCutchan18-Sep-13 22:01 
QuestionVS2010 WSAT Error - Unable to connect to SQL Server database Pin
DRAYKKO18-Sep-13 16:10
professionalDRAYKKO18-Sep-13 16:10 
AnswerRe: VS2010 WSAT Error - Unable to connect to SQL Server database Pin
Richard Deeming19-Sep-13 0:43
mveRichard Deeming19-Sep-13 0:43 
GeneralRe: VS2010 WSAT Error - Unable to connect to SQL Server database Pin
DRAYKKO19-Sep-13 2:43
professionalDRAYKKO19-Sep-13 2:43 
GeneralRe: VS2010 WSAT Error - Unable to connect to SQL Server database Pin
DRAYKKO19-Sep-13 6:04
professionalDRAYKKO19-Sep-13 6:04 
GeneralRe: VS2010 WSAT Error - Unable to connect to SQL Server database Pin
Richard Deeming19-Sep-13 7:38
mveRichard Deeming19-Sep-13 7:38 
GeneralRe: VS2010 WSAT Error - Unable to connect to SQL Server database Pin
DRAYKKO77719-Sep-13 12:38
DRAYKKO77719-Sep-13 12:38 
AnswerRe: VS2010 WSAT Error - Unable to connect to SQL Server database Pin
mastanp22-Sep-13 7:24
mastanp22-Sep-13 7:24 
GeneralRe: VS2010 WSAT Error - Unable to connect to SQL Server database Pin
DRAYKKO77722-Sep-13 10:34
DRAYKKO77722-Sep-13 10:34 

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.