dynamic upload folder is not working

Mar 13, 2009 at 12:47 AM
Edited Mar 13, 2009 at 12:52 AM
Hi
i want to use the FileUploader in my project but before i put it there im testing it.
so i dont want to use static upload folder.
for the test im getting the FolderName from a text box.
When i debug the project, the FolderName is changed,
but when i press the upload button it uploads in the initial path,
not in the desired path, although is created.
here is the code:
------------------------------------
<head runat="server">
    <title>File Uploader - Testing</title>
</head>
<body>
    <form id="form1" runat="server" >
    <div>
       &nbsp;<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
       <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Kreiraj pateka" /><br />
       <asp:Label ID="Label1" Text="tekst" runat="server" ></asp:Label>
       <br />
       <fjx:FileUploader ID="FileUploader1" runat="server">
            <Adapters>
                <fjx:FileSaverAdapter FolderName="UploadFolder"/>           
            </Adapters>
        </fjx:FileUploader>
    </div>          
    </form>  
</body>
</html>

and here is the code where im setting the FolderName:
-----------------------------
    protected void Button1_Click(object sender, EventArgs e)
    {
        string path = Server.MapPath(".").ToString();
        System.IO.Directory.CreateDirectory(path + "\\" + TextBox1.Text.ToString());
        Label1.Text = (path + "\\" + TextBox1.Text.ToString());
        ((com.flajaxian.FileSaverAdapter)(FileUploader1.Adapters[0])).FolderName = TextBox1.Text;
    }


Thanks

Coordinator
Mar 13, 2009 at 1:36 AM
The state of the adapters is not maintained accross postbacks. The whole idea of the control is not to have postbacks. But if you want you can always write your own adapters that would maintain the state accross postbacks.