Click here to Skip to main content
15,905,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a image folder has 650 image .jpg in my ftp server
I want to read this folder so include image filename and size
I read filename one by one but can not read size

how can I do ?
thanks
Posted
Comments
Member-2338430 10-Jun-13 6:50am    
type must bee byte

1 solution

You should use FileInfo.Length Property[^] to get the file size in byte.
See an example here[^].


--Amit
 
Share this answer
 
Comments
Member-2338430 10-Jun-13 7:26am    
I dont want to lenght I want to size
Member-2338430 10-Jun-13 7:44am    
FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create("ftp://xxx.xxx.xxx.xx/image/student/"+DropDownList1.SelectedValue+"/");
ftpRequest.Credentials = new NetworkCredential("xxxxxx", "xxxxxxx");
ftpRequest.Method = WebRequestMethods.Ftp.ListDirectory;
FtpWebResponse response = (FtpWebResponse)ftpRequest.GetResponse();
StreamReader streamReader = new StreamReader(response.GetResponseStream());
string line = streamReader.ReadLine();
while (line!=null)
{

line = streamReader.ReadLine();=>here comes ogrno1.jpg
long filelenght = response.contentlenght;
byte[] imageBytes = new byte[filelenght];

I want to get here image size type:byte because Iwill get this and Iwill store my database…



}

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