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..

Recommended Answers

All 4 Replies

>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.

>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..

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

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..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.