Click here to Skip to main content
15,885,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
string im = "sun.jpg";
byte[] imageArray = File.ReadAllBytes(@"~\image\" + im);
string base64ImageRepresentation = Convert.ToBase64String(imageArray);



Image i have saved in project itself and when i am giving the location of image
its going to c drive and its not searching in project
so i am getting this error.


VB
ERROR:

Could not find a part of the path 'C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0\~\image\sun.jpg'.
Posted
Comments
agent_kruger 30-May-14 4:35am    
sir, please post the location of your debug folder or your output folder.

1 solution

Specified image path
'C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0\~\image\sun.jpg'
is not really exist or directory is not found.


<br />
use instead adding project resources or Environment.StartupPath<br />


+ make sure that image file is located on same folder with application that you've executed.
 
Share this answer
 
v2

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