How can I set a dynamic save path?

Nov 28, 2008 at 6:26 PM
Hi,

I have an upload page, based on the demo example,  which works great when I am uploading to the same dir every time.

I now want to pass my save path via the query string to my uploads page.  This is were weirdness happens.  I can't access the QueryString value inside my upload_FileReceived function.

I know that the value exists, as I can display the value within a label on Page load.  I've also tried storing this value in a global variable, however the QueryString value never works inside the save function.

Here is the function:

    protected void upload_FileReceived(object sender, UploadEventArgs e)
    {
        if (e.File != null)
        {
            string savePath = Server.MapPath("/storage/"+ Request.QueryString["path"]);
            e.File.SaveAs(savePath + "\\" + e.File.FileName);
        }
    }

The files get saved in the storage folder, not the "path" folder.

Does anyone have an example of this control working with a dynamic save path?

much appreciated.
Dec 10, 2008 at 9:43 AM
Edited Dec 10, 2008 at 9:44 AM
Hi there,

I had the exact same problem. As I couldn't find a way to solve the issue from the page, I tweaked the source of the control a bit.
If you're using the precompiled dll, this won't help you, but if you're compiling it yourself, make the following change in Upload.cs:
in PreRender-method change the line:
_url = this.Page.Request.CurrentExecutionFilePath;
to:
_url = this.Page.Request.RawUrl;

and it should work.
Coordinator
Dec 10, 2008 at 12:01 PM
Guys,
Sorry about this late answer.
We will investigate this issue and get back to you as soon as possible.

Thanks,
Raul