Groups > Asp .Net > Getting started with ASP.NET > Re: upload/download files using http protocol




upload/download files using http protocol

upload/download files using http protocol
Thu, 3 Apr 2008 12:05:23 +0000
I am able to upload/download files using protocol if i know the file name.

pls. let me know,how to get file details from site?..

For example: my site URL :  http://10.0..01/Sourcefiles/

which contains n of files.I want to get files details.

 

Regards,

Viji.S
Post Reply
Re: upload/download files using http protocol
Thu, 3 Apr 2008 13:54:11 +0000
the System.IO.DirectoryInfo class gives lots of information about a directory.
it will allow you to interact with the filesystem structure as well.  I use it
to ensure directories exist before uploading to them.

Example:

public class FileSystemHelper
    {
        /// <summary>
        /// this method goes through each directory in the supplied path and
creates it 
        /// if it doesn't exist.
        /// 
        /// FileSystemHelper.EnsureDirectory(new
System.IO.DirectoryInfo(strFilePath));
        /// </summary>
        /// <param name="oDirInfo"></param>public static
void EnsureDirectory(System.IO.DirectoryInfo oDirInfo)
        {
            if (oDirInfo.Parent != null)
                EnsureDirectory(oDirInfo.Parent);
            if (!oDirInfo.Exists)
            {
                oDirInfo.Create();
                
            }
        }
    }

 If you wanted a listing of files in a particular directory, you would be able
to do that with the Directoryinfo.GetFiles() method. 

The help documentation for this class:

http://msdn2.microsoft.com/en-us/library/system.io.directoryinfo_members(VS.80).
aspx

I hope this helps
Post Reply
about | contact