0

hello Sir,
I can not able to store file content into byte variable.
I have do below code.
aspx.cs page:

[B]code on button click[/B]
           DirectoryInfo dInfo;
            FileInfo[] FilesList;
         byte[] bytecontent;
               dInfo = new DirectoryInfo(Server.MapPath("upload"));
                FilesList = dInfo.GetFiles();
                if (FilesList.Length>0)
                {
                     files = new string[FilesList.Length];
                    foreach (FileInfo fi in FilesList)
                    {

                       string fileName = fi.Name;
                       string filetype= // i haven't get code.
                       string filesize=//i haven't get code.
                         byteContent =// i haven't get code.
                }

i am trying to store this value after getting it.
Sir,i hope U will helpful to me..

2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Pari13
0

>I can not able to store file content into byte variable.

Where you want to store these information. In database? In case of memory, information is already stored into FileList array.

0

>I can not able to store file content into byte variable.

Where you want to store these information. In database? In case of memory, information is already stored into FileList array.

of course Sir, file Information is stored into FileList array ,but i want to take all information in various variable and after it ,stored those values into Database.
once values(file informaiotion) store into database, I Delete that files from Folder(or directory) that contain the files.
I am calling one method that has different parameter like filename,filecontent,filetype,filesize.and then i stored this values into database.

plz,sir help on my probelm..

0

1. Use System.IO.Path.GetExtension() method get file type.
2. fi.Length return filesize
3. System.IO.File.ReadAllBytes(file_path) to have array of bytes

0

1. Use System.IO.Path.GetExtension() method get file type.
2. fi.Length return filesize
3. System.IO.File.ReadAllBytes(file_path) to have array of bytes

Thank U Sir... ,for better solution..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.