Click here to Skip to main content
15,889,595 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionImage locking Pin
Dholakiya Ankit19-Sep-13 18:26
Dholakiya Ankit19-Sep-13 18:26 
AnswerRe: Image locking Pin
Bernhard Hiller19-Sep-13 21:35
Bernhard Hiller19-Sep-13 21:35 
GeneralRe: Image locking Pin
Dholakiya Ankit19-Sep-13 22:35
Dholakiya Ankit19-Sep-13 22:35 
AnswerRe: Image locking Pin
David Mujica20-Sep-13 2:20
David Mujica20-Sep-13 2:20 
GeneralRe: Image locking Pin
Dholakiya Ankit20-Sep-13 2:24
Dholakiya Ankit20-Sep-13 2:24 
QuestionDisplay images from server folder Pin
SAM_India19-Sep-13 8:20
SAM_India19-Sep-13 8:20 
AnswerRe: Display images from server folder Pin
jkirkerx19-Sep-13 13:20
professionaljkirkerx19-Sep-13 13:20 
AnswerRe: Display images from server folder Pin
Pratik Bhuva24-Sep-13 21:21
professionalPratik Bhuva24-Sep-13 21: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 14:54
SAM_India1-Oct-13 14:54 
GeneralRe: Display images from server folder Pin
Pratik Bhuva4-Oct-13 23:17
professionalPratik Bhuva4-Oct-13 23:17 
AnswerRe: Display images from server folder Pin
Vishnu Prajapati24-Sep-13 22:38
professionalVishnu Prajapati24-Sep-13 22:38 
QuestionI need a free hosting for asp.net with sql server, is it possible? Pin
Member 1028433219-Sep-13 0:51
Member 1028433219-Sep-13 0:51 
AnswerRe: I need a free hosting for asp.net with sql server, is it possible? Pin
hypermellow19-Sep-13 1:17
professionalhypermellow19-Sep-13 1:17 
AnswerRe: I need a free hosting for asp.net with sql server, is it possible? Pin
David C# Hobbyist.19-Sep-13 7:36
professionalDavid C# Hobbyist.19-Sep-13 7:36 
AnswerRe: I need a free hosting for asp.net with sql server, is it possible? Pin
mastanp22-Sep-13 6:06
mastanp22-Sep-13 6:06 
QuestionOnline Backup in asp .net Pin
Vicky_Aryan18-Sep-13 20:01
Vicky_Aryan18-Sep-13 20:01 
AnswerRe: Online Backup in asp .net Pin
Richard MacCutchan18-Sep-13 21:01
mveRichard MacCutchan18-Sep-13 21:01 
QuestionVS2010 WSAT Error - Unable to connect to SQL Server database Pin
DRAYKKO18-Sep-13 15:10
professionalDRAYKKO18-Sep-13 15:10 
AnswerRe: VS2010 WSAT Error - Unable to connect to SQL Server database Pin
Richard Deeming18-Sep-13 23:43
mveRichard Deeming18-Sep-13 23:43 
GeneralRe: VS2010 WSAT Error - Unable to connect to SQL Server database Pin
DRAYKKO19-Sep-13 1:43
professionalDRAYKKO19-Sep-13 1:43 
GeneralRe: VS2010 WSAT Error - Unable to connect to SQL Server database Pin
DRAYKKO19-Sep-13 5:04
professionalDRAYKKO19-Sep-13 5:04 
GeneralRe: VS2010 WSAT Error - Unable to connect to SQL Server database Pin
Richard Deeming19-Sep-13 6:38
mveRichard Deeming19-Sep-13 6:38 
GeneralRe: VS2010 WSAT Error - Unable to connect to SQL Server database Pin
DRAYKKO77719-Sep-13 11:38
DRAYKKO77719-Sep-13 11:38 
AnswerRe: VS2010 WSAT Error - Unable to connect to SQL Server database Pin
mastanp22-Sep-13 6:24
mastanp22-Sep-13 6:24 
GeneralRe: VS2010 WSAT Error - Unable to connect to SQL Server database Pin
DRAYKKO77722-Sep-13 9:34
DRAYKKO77722-Sep-13 9: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.