how to set the path for directory

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rama Jayapal
    New Member
    • Mar 2007
    • 24

    how to set the path for directory

    hi am developing an application to upload images to gridview which i have completed ,now i need to create directories and subdirectories to upload the images according to their type i have written a class to read all directories like

    public Classname[] Getdirectories( string name)

    {

    string basepath=System .Web.Hosting.Ho stingEnvironmen t.ApplicationPh ysicalPAth +"images"+"/"+name;

    string[] files=Directory .GetDirectories (basepath);

    }

    this coding was working only for the first set of subdirectories

    but on further read it gives an error like

    Could not find a part of the path 'C:\Documents and Settings\Applic ationName\image s\Sub'.


    This is because ,a directory name is missing between the ' images' folder and 'Sub' Folder



    i changed the coding like

    String basepath=System .Web.Hosting.Ho stingEnvironmen t.Mappath(name) ;



    but it gives me an error like

    The relative virtual path 'Directoryname' is not allowed here

    can anyone help me on this regard on how to set the path for the directory in oder to read them dynamically



    plz help me on this regard

    Rama
Working...