Click here to Skip to main content
16,011,428 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dictionary Values copy Pin
J4amieC19-May-08 2:47
J4amieC19-May-08 2:47 
GeneralRe: Dictionary Values copy Pin
George_George19-May-08 2:52
George_George19-May-08 2:52 
GeneralRe: Dictionary Values copy Pin
leppie19-May-08 3:32
leppie19-May-08 3:32 
GeneralRe: Dictionary Values copy Pin
George_George19-May-08 4:26
George_George19-May-08 4:26 
QuestionRegarding XML loading [modified] Pin
manikandanid19-May-08 1:42
manikandanid19-May-08 1:42 
AnswerRe: Regarding XML loading [modified] Pin
J4amieC19-May-08 2:05
J4amieC19-May-08 2:05 
AnswerRe: Regarding XML loading Pin
Mike Dimmick19-May-08 2:25
Mike Dimmick19-May-08 2:25 
QuestionVS 2005 Image control Pin
Dextter19-May-08 1:33
Dextter19-May-08 1:33 
Hi,

I tried to display an image in an image control in VS 2005, every other thing works except the displaying of the image. However, it works with VS 2003. Here's my code:

protected void uploadButton_Click(object sender, EventArgs e)
{

string fileName = FileUpload1.PostedFile.FileName;
fileName = Path.GetFileName(fileName);
string fileFolder = Server.MapPath("~/images/");
string filePath;

bool fileOk = false;

if (FileUpload1.PostedFile.ContentLength > 0)
{

string fileExtension = Path.GetExtension(FileUpload1.PostedFile.FileName).ToString();
string[] allowedExtensions = { ".gif", ".jpeg", ".jpg", ".png" };
for (int i = 0; i < allowedExtensions.Length; i++)
{

if (fileExtension == allowedExtensions[i])
{
fileOk = true;

if (fileOk == true)
{
if (!Directory.Exists(fileFolder))
{

Directory.CreateDirectory(fileFolder);

}

filePath = fileFolder + fileName;

if (File.Exists(filePath))
{

msgBox.Text = fileName + " " + "already exists on the Web server";
return;

}


FileUpload1.PostedFile.SaveAs(filePath);
Image1.ImageUrl = filePath;

I need help on how to display the image.

Thanks.

Obinna from Nigeria.

//obinnaaj Eof

AnswerRe: VS 2005 Image control Pin
leppie19-May-08 2:30
leppie19-May-08 2:30 
QuestionSolution Structure Pin
mark_w_19-May-08 0:44
mark_w_19-May-08 0:44 
AnswerRe: Solution Structure Pin
Christian Graus19-May-08 0:50
protectorChristian Graus19-May-08 0:50 
GeneralRe: Solution Structure [modified] Pin
mark_w_19-May-08 0:52
mark_w_19-May-08 0:52 
AnswerRe: Solution Structure Pin
Simon P Stevens19-May-08 1:02
Simon P Stevens19-May-08 1:02 
AnswerRe: Solution Structure Pin
tgrt19-May-08 1:43
tgrt19-May-08 1:43 
QuestionGlobalization question Pin
Glen Harvy19-May-08 0:28
Glen Harvy19-May-08 0:28 
AnswerRe: Globalization question Pin
carbon_golem19-May-08 1:57
carbon_golem19-May-08 1:57 
GeneralRe: Globalization question Pin
Glen Harvy19-May-08 2:18
Glen Harvy19-May-08 2:18 
QuestionHow to create custom control Pin
Krish Agn19-May-08 0:23
Krish Agn19-May-08 0:23 
AnswerRe: How to create custom control Pin
Christian Graus19-May-08 0:32
protectorChristian Graus19-May-08 0:32 
GeneralRe: How to create custom control Pin
Krish Agn19-May-08 0:54
Krish Agn19-May-08 0:54 
GeneralRe: How to create custom control Pin
Christian Graus19-May-08 0:58
protectorChristian Graus19-May-08 0:58 
GeneralRe: How to create custom control Pin
Krish Agn20-May-08 0:06
Krish Agn20-May-08 0:06 
QuestionClass library for file compression Pin
Krishnaraj Barvathaya B19-May-08 0:21
Krishnaraj Barvathaya B19-May-08 0:21 
AnswerRe: Class library for file compression Pin
Christian Graus19-May-08 0:33
protectorChristian Graus19-May-08 0:33 
GeneralRe: Class library for file compression Pin
dan!sh 19-May-08 1:38
professional dan!sh 19-May-08 1:38 

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.