Problems after upgrade - ParamNameFileIdent, ParamNameFilePath

10 posts, 0 answers
  1. Patrick
    Patrick avatar
    17 posts
    Member since:
    May 2009

    Posted 31 Mar 2011 Link to this post

    We upgrade our solution to VS 2010 and RadControls Q3. We encountered one minor problem in the whole upgrade with the following code snippet in our RadUploadHandler.ashx:

    #region

     

     

    ReturnMandatoryParameters

     

     

     

     

    private void ReturnMandatoryParameters(bool success, bool finalFileRequest)

     

     

    {

     

     

     

    string fileName = this.Request.Form[RadUploadConstants.ParamNameFileName];

     

     

     

     

    string filePath = this.GetFilePath(fileName);

     

     

     

     

    // We need all this arguments sent back to the upload control.

     

     

     

    // Please do not remove them.

     

     

     

    this.AddReturnParam(RadUploadConstants.ParamNameSuccess, success);

     

     

     

     

    this.AddReturnParam(RadUploadConstants.ParamNameFileIdent, filePath);

     

     

     

     

    this.AddReturnParam(RadUploadConstants.ParamNameFileName, fileName);

     

     

     

     

    this.AddReturnParam(RadUploadConstants.ParamNameFilePath, filePath);

     

     

     

     

    this.AddReturnParam(RadUploadConstants.ParamNameFinalFileRequest, finalFileRequest);

     

     

    }

    #endregion

    Telerik.Windows.Controls.RadUploadConstants does not contain a definition for ParamNameFileIdent
    Telerik.Windows.Controls.RadUploadConstants does not contain a definition for ParamNameFilePath

    Does anybody know what we need to change to make this work?
  2. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 06 Apr 2011 Link to this post

    Hi Patrick,

    These constants were removed for Q3. The RadUploadConstant's class members are strings that the AddReturnParam method takes as first parameter, so basically you can create your own constants and use them instead.

    Regards,
    Alex Fidanov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Patrick
    Patrick avatar
    17 posts
    Member since:
    May 2009

    Posted 06 Apr 2011 Link to this post

    Do you have a new sample RadUploadHandler that you can send me the link to for the Q3 version. I am guessing I have to tweak my current RadUploadHandler to take advantage of the new features. I would really appreciate if you post a link or email me a sample handler. Thanks a bunch.
  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 12 Apr 2011 Link to this post

    Hello Patrick,

    Our suggestion was to create your own static class to hold the constants that aren't defined in the RadUploadConstants class. I prepared a sample project that implements that solution.

    Also, you can find more info about the upload service parameters here and also check out this KB article describing some of the major changes in the control's implementation. Moreover you can find the most basic scenarios in which the control is used in the Upload KB section.

    I hope that info will help you.

    Regards,
    Tina Stancheva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Patrick
    Patrick avatar
    17 posts
    Member since:
    May 2009

    Posted 20 Apr 2011 Link to this post

    I have taken all the code out of the ProcessRequest and put it into the overriden SaveChunkData method. I commented out the ProcessRequest and IsReusable methods in my new handler. The problem that I am facing is that when I am trying to access the threadID from my SaveChunkData method it is always null no matter what I try. What am I not understanding?

     

     

    //public void ProcessRequest(HttpContext context)

     

     

     

    //{

     

     

     

    // context.Response.ContentType = "text/plain";

     

     

     

    // context.Response.Write("Hello World");

     

     

     

    //}

     

     

     

    //public bool IsReusable

     

     

     

    //{

     

     

     

    // get

     

     

     

    // {

     

     

     

    // return false;

     

     

     

    // }

     

     

     

    //}

     

    #region

     

     

    SaveChunkData

     

     

     

     

    public override bool SaveChunkData(string filePath, long position, byte[] buffer, int contentLength, out int savedBytes)

     

     

    {

     

     

     

    bool result = base.SaveChunkData(filePath, position, buffer, contentLength, out savedBytes);

     

     

     

     

    try

     

    {

     

     

    string threadID = Context.Request.QueryString["threadID"];

     

     

     

     

    //string threadID = HttpContext.Current.Request.QueryString["threadID"];

     

     

     

    //string tID = this.Request.Form["threadID"];

     

     

     

    //string thID = this.Request.QueryString["threadID"];

     

     

     

    //string threadID = Request.QueryString["threadID"];

     

     

     

    if (!String.IsNullOrEmpty(this.Request.Form["threadID"]))

     

     

    {

     

     

     

    if (!SYLWebUtility.ImageHelper.VerifyDirectoryExistsForNewFile(this.GetFilePath()))

     

     

    {

     

     

     

    this.AddReturnParam(RadUploadConstants.ParamNameMessage, UserInterfaceMessages.UserInterfaceMessage.ErrorMessage(UserInterfaceMessages.Enumerations.UIErrorMessage.ProblemsAddingData, SYLWebUtility.LanguageHelper.GetLanguageIDByTwoLetterISOLanguageName()));

     

     

     

     

    this.ReturnMandatoryParameters(result, this.IsFinalFileRequest());

     

     

     

     

    return result;

     

     

    }

     

     

     

    if (this.IsFinalFileRequest())

     

     

    {

     

     

     

    //If the file is successfully uploaded.

     

     

     

    if (result)

     

     

    {

     

     

     

    this.SaveFiles();

     

     

    }

     

    }

     

    }

     

     

     

    else

     

    {

     

     

    if (SYLWebUtility.ImageHelper.VerifyFileExists(this.GetFilePath()))

     

     

    {

     

     

     

    //Deletes the specified file. An exception is not thrown if the specified file does not exist.

     

    System.IO.

     

    File.Delete(this.GetFilePath());

     

     

    }

     

    }

     

    ReturnMandatoryParameters(result,

     

    this.IsFinalFileRequest());

     

     

     

     

    return result;

     

     

    }

     

     

     

    catch (Exception)

     

     

    {

     

     

     

    if (SYLWebUtility.ImageHelper.VerifyFileExists(this.GetFilePath()))

     

     

    {

     

     

     

    //Deletes the specified file. An exception is not thrown if the specified file does not exist.

     

    System.IO.

     

    File.Delete(this.GetFilePath());

     

     

    }

     

    ReturnMandatoryParameters(result,

     

    this.IsFinalFileRequest());

     

     

     

     

    return result;

     

     

    }

     

     

     

    }

    #endregion

  7. Patrick
    Patrick avatar
    17 posts
    Member since:
    May 2009

    Posted 22 Apr 2011 Link to this post

    Looking at my previous post I am not really clear on what the problem is. Basiscally I am trying to read the threadID out of the querystring in the SaveChunkData method but it is always null whatever I try. There is a value in the querystring I can see it but when I step throught he code the value is always null, I have tried to read the threadID in the follwoing was:

     

     

    string baseThreadID = base.Request.QueryString["threadID"];

     

     

     

     

    string contextThreadID = base.Context.Request.QueryString["threadID"];

     

     

     

     

    string threadID = Context.Request.QueryString["threadID"];

     

     

     

     

    //string threadID = HttpContext.Current.Request.QueryString["threadID"];

     

     

     

    //string tID = this.Request.Form["threadID"];

     

     

     

    //string thID = this.Request.QueryString["threadID"];

     

     

     

    //string threadID = Request.QueryString["threadTypeID"];

     


    The threadID value is always null. Any ideas?
  8. Patrick
    Patrick avatar
    17 posts
    Member since:
    May 2009

    Posted 23 Apr 2011 Link to this post

    I need somebody to enlighten me.  I rearranged my code but still I can read the threadID value out of the querystring. What am I doing wrong?

     

     

    public override bool SaveChunkData(string filePath, long position, byte[] buffer, int contentLength, out int savedBytes)

     

     

    {

     

     

     

    bool result = base.SaveChunkData(filePath, position, buffer, contentLength, out savedBytes);

     

     

     

     

    try

     

    {

     

     

    if (this.IsFinalFileRequest())

     

     

    {

     

     

     

    //If the file is successfully uploaded.

     

     

     

    if (result)

     

     

    {

     

     

     

    string threadID = this.Request.Form["threadID"];

     

     

     

     

    if (!String.IsNullOrEmpty(this.Request.Form["threadID"]))

     

     

    {

     

     

     

    if (!SYLWebUtility.ImageHelper.VerifyDirectoryExistsForNewFile(this.GetFilePath()))

     

     

    {

     

     

     

    this.AddReturnParam(RadUploadConstants.ParamNameMessage, UserInterfaceMessages.UserInterfaceMessage.ErrorMessage(UserInterfaceMessages.Enumerations.UIErrorMessage.ProblemsAddingData, SYLWebUtility.LanguageHelper.GetLanguageIDByTwoLetterISOLanguageName()));

     

     

     

     

    this.ReturnMandatoryParameters(result, this.IsFinalFileRequest());

     

     

     

     

    return result;

     

     

    }

     

     

     

    this.SaveFiles();

     

     

    }

     

     

     

    else

     

    {

     

     

    if (SYLWebUtility.ImageHelper.VerifyFileExists(this.GetFilePath()))

     

     

    {

     

     

     

    //Deletes the specified file. An exception is not thrown if the specified file does not exist.

     

    System.IO.

     

    File.Delete(this.GetFilePath());

     

     

    }

     

    }

     

    }

     

    }

     

    ReturnMandatoryParameters(result,

     

    this.IsFinalFileRequest());

     

     

     

     

    return result;

     

     

    }

     

     

     

    catch (Exception)

     

     

    {

     

     

     

    if (SYLWebUtility.ImageHelper.VerifyFileExists(this.GetFilePath()))

     

     

    {

     

     

     

    //Deletes the specified file. An exception is not thrown if the specified file does not exist.

     

    System.IO.

     

    File.Delete(this.GetFilePath());

     

     

    }

     

    ReturnMandatoryParameters(result,

     

    this.IsFinalFileRequest());

     

     

     

     

    return result;

     

     

    }

     

     

     

    }

  9. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 26 Apr 2011 Link to this post

    Hi Patrick,

    In the original post, you wanted to pass back and forth messages between the RadUpload and the RadUploadHandler, which Tina demonstrated with a sample solution in the post. Are you still not able to do this using her approach/sample code? I tested this and it worked perfectly.

    Greetings,
    Alex Fidanov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  10. Patrick
    Patrick avatar
    17 posts
    Member since:
    May 2009

    Posted 26 Apr 2011 Link to this post

    Hi Alex,

    thank you for your reply. Everything is working, what I am struggling with is that I can't read the threadID out of the querystring in the SaveChunkData method. I get intellisense, I can step through the code and the threadID is always null even though I have a threadID in the querystring. I am guessing I have no access to the HttpContext in the overriden SaveChunkData method. Here is what I have tried:

    //http://localhost/myapp/User/MultiPhotoUpload.aspx?threadID=20&threadTypeID=3
                    //HttpContext.Current.Handler.ProcessRequest(HttpContext.Current);
                    HttpContext.Current.CurrentHandler.ProcessRequest(HttpContext.Current);

                    HttpRequest request = Context.Request;

                    string testRequest = request.QueryString["threadID"];

                    string thisFormThreadID = this.Request.Form["threadID"];

                    string thisThreadID = this.Request.QueryString["threadID"];

                  //HttpContext context = new base.Request.QueryString["threadID"];

                    string testThreadID = HttpContext.Current.Request.QueryString["threadID"];

                    string formThreadID = HttpContext.Current.Request.Form["threadID"];

                    //HttpContext.Current.Handler.ProcessRequest(HttpContext.Current);

                    string baseThreadID = base.Request.QueryString["threadID"];

                    string contextThreadID = base.Context.Request.QueryString["threadID"];

                    string threadID = Context.Request.QueryString["threadID"];
                    //string threadID = HttpContext.Current.Request.QueryString["threadID"];

                    //string tID = this.Request.Form["threadID"];

                    //string thID = this.Request.QueryString["threadID"];

                    //string threadID = Request.QueryString["threadTypeID"];

    Any idea why threadID is always null?

  11. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 29 Apr 2011 Link to this post

    Hello Patrick,

    Answer in the duplicate thread here.

    Regards,
    Alex Fidanov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
DevCraft banner