Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to fetch employee pictures from server.
i have folder name--'Uploads'
where all employees images are saved with the name of employee id
help me to fetch that .
how to set path
plz help me
XML
code is working for local system.
whenever path of my server foler is--
\\182.162.4.125\c$\hr\Uploads



If empid.Text = String.Empty Then
         picEmpProfile.BackgroundImage = Image.FromFile(Application.StartupPath & "\Uploads\Bears.jpg")
       Else
           picEmpProfile.BackgroundImage = Image.FromFile(Application.StartupPath & "\Uploads\" & empid.Text & ".jpg")

       End If
Posted
Updated 24-Jun-14 20:41pm
v7
Comments
Sergey Alexandrovich Kryukov 25-Jun-14 2:28am    
Could you format it to make it readable? Please use "Improve question".

Now, there is no such thing as "server". It all depends on what kind of server do you want to use. By the way: why? If this is just the file server (not a very good idea), use proper full name (UNC) you will be able to see in, say, Explorer...

—SA
neeraj_ 25-Jun-14 2:38am    
an example sir please

how me should to use above code
Sergey Alexandrovich Kryukov 25-Jun-14 2:55am    
Example of what?! You did not even clarify anything. Please, read my comment above again.
—SA

1 solution

Try:
C#
WebRequest request = WebRequest.Create("http://www.MyDomain.com/Resources/Images/Logos/MyPicture.png");

WebResponse response = request.GetResponse();
Stream stream = response.GetResponseStream();
pictureBox1.Image = Bitmap.FromStream(stream);
 
Share this answer
 
Comments
neeraj_ 25-Jun-14 3:26am    
this is a windows form application sir
OriginalGriff 25-Jun-14 3:53am    
Yes, I guessed that from the title: "in windows form application" was a good clue....

You can use WebRequest in Winforms as well as website applications - try it! All you need to do is add the appropriate using line:
using System.Net;
And it'll work.
Just make sure that the stream is available for the lifetime of the Image.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900