Re: Default folder and file type

  •  09-29-2008, 10:46 PM

    Re: Default folder and file type

    Hi SLTDon,
     
    you can try this way

     void Uploader_FileUploaded(object sender, UploaderEventArgs args)
        {

            string ext=System.IO.Path.GetExtension(args.FileName.ToLower());
            string folder = "c:\\save\\default";
            switch (ext)
            {
                case ".pdf":
                case ".doc":
                case ".txt":
                    folder = "c:\\save\\doc";
                    break;
                case ".gif":
                case ".jpg":
                case ".png":
                    folder = "c:\\save\\img";
                    break;
                default:
                    folder = "c:\\save\\default";
                    break;
            }

            if (!Directory.Exists(folder))
                Directory.CreateDirectory(folder);
            string newpath = Path.Combine(folder, args.FileName);
            args.CopyTo(newpath);

          }

     
     
    Regards
     
    Ken
View Complete Thread