This is a migrated thread and some comments may be shown as answers.

Problems after upgrade - ParamNameFileIdent, ParamNameFilePath

9 Answers 75 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 31 Mar 2011, 07:16 PM
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?

9 Answers, 1 is accepted

Sort by
0
Alex Fidanov
Telerik team
answered on 06 Apr 2011, 09:18 AM
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
0
Patrick
Top achievements
Rank 1
answered on 07 Apr 2011, 01:23 AM
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.
0
Tina Stancheva
Telerik team
answered on 12 Apr 2011, 01:21 PM
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
0
Patrick
Top achievements
Rank 1
answered on 21 Apr 2011, 01:28 AM
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

0
Patrick
Top achievements
Rank 1
answered on 22 Apr 2011, 08:52 PM
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?
0
Patrick
Top achievements
Rank 1
answered on 24 Apr 2011, 12:49 AM
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;

 

 

}

 

 

 

}

0
Alex Fidanov
Telerik team
answered on 26 Apr 2011, 08:02 AM
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
0
Patrick
Top achievements
Rank 1
answered on 26 Apr 2011, 05:59 PM
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?

0
Alex Fidanov
Telerik team
answered on 29 Apr 2011, 08:52 AM
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
Tags
Upload
Asked by
Patrick
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
Patrick
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or