views:

30

answers:

2

Can anybody tell me that how to convert a image path into bytes to store in database in asp.net.please help me out.

+1  A: 

Why do you want to store the path as bytes? Why don't you just store it as a string? Unless you mean you want to store the image data as bytes in the database, in which case, look into the Image data type.

Greg B
A: 

I think what you are looking is?

 byte[] myByte = new byte[fupImage.PostedFile.ContentLength];
 Stream imgStream = fupImage.PostedFile.InputStream;
 imgStream.Read(myByte, 0, fupImage.PostedFile.ContentLength);
Muhammad Akhtar