Onfilenamedetermining , can not read url parameters, viewstate or other page data?

Oct 15, 2009 at 1:27 AM

I am using the Onfilenamedetermining event to change the name of the file.  My goal is to rename the files based on ids given by my CMS.  I have a contentblock that gets its id as a dynamic parameter from the url query string parameters url?id=X...  I am trying to use this contentblock id to rename my file but can not access this, all I get is an empty string, what am I doing wrong?

ASPX code:

<fjx:fileuploader id="FileUploader1" allowedfiletypes="Flash Videos:*.flv;*.txt;*.xml;*.doc"
                    runat="server" issinglefilemode="True" transparentbackground="True">
    <Adapters>
        <fjx:DirectAmazonUploader OnFileNameDetermining="FileUploader1_FileNameDetermining"
        OnConfirmUpload="FileUploader1_ConfirmUpload" ConfirmUploadJsFunc="ConfirmUploadJsFunc"
            Path="videos"
            FileAccess="Private"
            AccessKey="WebConfig:AmazonAccessKey"
            SecretKey="WebConfig:AmazonSecretKey"
            BucketName="origotree"  AllowPathDefinedByClient="False" />
    </Adapters>
</fjx:fileuploader>

VB.net code (each of these fail to get the id parameter...

Protected Sub FileUploader1_FileNameDetermining(ByVal sender As Object, ByVal e As com.flajaxian.FileNameDeterminingEventArgs)
        e.FileName = "test" & request.querystring("id") & ".txt"
        'e.FileName = "test" & viewstate("id") & ".txt"
        'e.FileName = "test" & content.id("id") & ".txt" ' this is done through a control specific to my cms... just showing that it does not work here
End Sub

 

Oct 21, 2009 at 3:33 PM

Hello???  Any one that can help?  I am fairly knew to web development software so perhaps this is trivial or not. 

 

Coordinator
Oct 21, 2009 at 4:55 PM

When you have ajax call it happens on a different request by definition so you won't find any of those

Oct 21, 2009 at 5:05 PM

so how can i pass in a variable with a content id to this call back function?  I was looking for an example of passing arguments... or any info on this.

Coordinator
Oct 22, 2009 at 1:21 AM

This is not currently implemented but you can easily add it. The description of what to change is here:

http://flajaxians3upload.codeplex.com/Thread/View.aspx?ThreadId=69486#RadPostEditor

Oct 22, 2009 at 3:22 PM

I had real trouble with the State variables. Never got them to work so just made the following change in the source:

 

 	protected string _pageUrl;

        public string PageUrl
        {
            get
            {
                return this.ComposePageUrl(HttpContext.Current.Request.Url.AbsoluteUri.Substring(0,
                            HttpContext.Current.Request.Url.AbsoluteUri.Length - HttpContext.Current.Request.Url.Query.Length));

                //return this.ComposePageUrl(HttpContext.Current.Request.Url.AbsoluteUri.Substring(0,
                //            HttpContext.Current.Request.Url.AbsoluteUri.Length));
            }
            set
            {
                _pageUrl = value;
            }
        }

This allowed me to set the full PageUrl specifically (and thus pass it any extra querystring parameters). Then I updated the ComposePageUrl method to include a check if this variable has been set: 

 

private string ComposePageUrl(string pageUrl)
        {
            if (!String.IsNullOrEmpty(_pageUrl))
                pageUrl = _pageUrl;
	...


This may not be the tidiest or smartest way to do this, but it got me through... hope it helps!

 

 

 

 

protected string page_url;
        public string PageUrl
        {
            get
            {
                return this.ComposePageUrl(HttpContext.Current.Request.Url.AbsoluteUri.Substring(0,
                            HttpContext.Current.Request.Url.AbsoluteUri.Length - HttpContext.Current.Request.Url.Query.Length));
                //return this.ComposePageUrl(HttpContext.Current.Request.Url.AbsoluteUri.Substring(0,
                //            HttpContext.Current.Request.Url.AbsoluteUri.Length));
            }
            set
            {
            //    return this.ComposePageUrl(HttpContext.Current.Request.Url.AbsoluteUri.Substring(0,
            //                HttpContext.Current.Request.Url.AbsoluteUri.Length - HttpContext.Current.Request.Url.Query.Length));
                page_url = value;
            }
        }
 protected string _pageUrl;

        public string PageUrl
        {
            get
            {
                return this.ComposePageUrl(HttpContext.Current.Request.Url.AbsoluteUri.Substring(0,
                            HttpContext.Current.Request.Url.AbsoluteUri.Length - HttpContext.Current.Request.Url.Query.Length));

                //return this.ComposePageUrl(HttpContext.Current.Request.Url.AbsoluteUri.Substring(0,
                //            HttpContext.Current.Request.Url.AbsoluteUri.Length));
            }
            set
            {
            //    return this.ComposePageUrl(HttpContext.Current.Request.Url.AbsoluteUri.Substring(0,
            //                HttpContext.Current.Request.Url.AbsoluteUri.Length - HttpContext.Current.Request.Url.Query.Length));
                _pageUrl = value;
            }
        }