urvish jain

Hi All,

I've this problem of viewing the uploaded files.
The Scenario is as follows:
The User goes to website, fills a complaining form and attaches a complaint file and uploads the information. This file can be txt, doc or image file.

This complaing details and uploaded file is to be viewed by Admnistrator from an admin Console (A windows appln)

The problem is i'm able to view text and word files but not image files. The Admin console resides on Windows 2003 Server.

Kindly Help

Thanks in Advance


Re: Visual C# General Cannot Open Image file from Console Application (C#)

ahmedilyas

We need some more information I'm afraid.

How are you viewing the files What happens when you try to view the image file Can you show us the code and any errors that happens






Re: Visual C# General Cannot Open Image file from Console Application (C#)

urvish jain

Uploaded file link is given in a grid when i click on particular cell the following code is executed.

try

{

DataTable dt = (DataTable)dataGridView2.DataSource;

string FilePath = dt.Rows[e.RowIndex][7].ToString();

FilePath = "Department/" + FilePath;

System.Diagnostics.Process.Start(FilePath);

}

catch (Exception exp)

{

MessageBox.Show("Cannot Open File ");

}

This is the code where i get the file path of uploaded file and i try to open it. .txt and .doc works fine problem is with image files. It doesn't even give "Cannot Open File" message. Nothing happens.





Re: Visual C# General Cannot Open Image file from Console Application (C#)

ahmedilyas

I wouldn't understand why. Are you sure the path is correct to the image If it werent, then the Process would throw an error about not being able to find the file.






Re: Visual C# General Cannot Open Image file from Console Application (C#)

urvish jain

No Exception thrown by Process.Start function. As i said txt files and word files open with this command even image files open if i run it from local machine(Windows XP) but when Admin console application is installed on Windows 2003 Server the image files do not open up.

Is it the problem because of compatibilty of console application with windows 2003 server. Or Some Installation settings need to be done





Re: Visual C# General Cannot Open Image file from Console Application (C#)

Zamial

Does the file open on the server if you just double click it




Re: Visual C# General Cannot Open Image file from Console Application (C#)

urvish jain

Yes





Re: Visual C# General Cannot Open Image file from Console Application (C#)

Figo Fei - MSFT

Hi urvish,

Can we simply open an exist image file in that directory

If the image files are in local disk, the path should be divided by back slash: \

So check the code:

Code Snippet
FilePath = "Department/" + FilePath;

If use the code: System.Diagnostics.Process.Start("Department\\image.bmp"); supposing that image.bmp does exist in that directory.

Will it work

Give a try.

Thanks






Re: Visual C# General Cannot Open Image file from Console Application (C#)

Zamial

If there is no error throw etc. I like the idea it's the OS preventing the image/app from opening.

This could be a secuirty/permission type of problem, you could check the EventLog just after trying to open an image and see if any entries pop up shedding light on the problem.

It does sound strange, have you tried installing the app on other machines to and checking if it works as wanted.

Preferably not a development machine.





Re: Visual C# General Cannot Open Image file from Console Application (C#)

urvish jain



Hi,

I tried Installing the application on two different machines one with Windows XP and other with Windows 2003 Server

Following were the observations:

WinXP: The Microsoft picure viewer opens but image does not open up

Win 2003: Nothing happens except an hour glass symbol near a cursor appears and disappears.