HOW DO I : Change Foldername from codebehind

Jul 7, 2008 at 6:36 AM
Edited Jul 7, 2008 at 6:39 AM

Can someone please tell me how to change foldername from code behind please.  I want to change the foldername when my page loads with  a session variable. code would be great if someone could provide a example


Jul 7, 2008 at 4:44 PM
DirectCast(FileUploader1.Adapters(0), FileSaverAdapter).FolderName = "theFolderName"

assuming that your first adapter is FileSaverAdapter
Jul 8, 2008 at 12:46 AM
thanks worked great
Jul 18, 2008 at 3:15 PM

it gives error while uploading.
workDirectory = "UploadImages";
thisDir = "C:\\Documents and Settings\\Prasad\\" + workDirectory;
            ((FileSaverAdapter)FileUploader1.Adapters[0]).FolderName = workDirectory;
            ((ThumbGeneratorAdapter)FileUploader1.Adapters[1]).FolderName = workDirectory;

it creates the directory and during run time I check that the adapter folder names are also ok.
But it say..error uploading.

Any ideas?

Thanks in advance,
Jul 20, 2008 at 3:22 AM

Well C:\\Documents and Settings\\Prasad is not an address within your web site, so if you whant to do that you have to use custom code as:
<SCRIPT runat="server">
protected void FileUploader_FileReceived(Object sender, FileReceivedEventArgs e){
    string fileName = e.File.FileName;
    // here rename the file to whatever you want
    e.File.SaveAs(YOURPATH + fileName);

<fjx:FileUploader OnFileReceived="FileUploader_FileReceived" runat="server"></fjx:FileUploader>