Hi there,
I have been using the Upload control for quite a while now using my own custom AsyncUploadResult class.
What happens now is unexpected as I'm trying to save the absolute path to the uploaded file into a string variable and this ends up in a error thrown statint the escape sequence is not recognized. See below :
My custom upload class :
My UploadHandler:
And my FileUploaded event Handler;
And it fails on row 3 with the following error message:
"Exception has been thrown by the target of an invocation."
Unrecognized escape sequence. (430): {"SourceFilePath":"C:\Dev\NRP\NRP\Study\UploadTemp\1411349019322101001_20140410-125730_PTAP.sld"}
Is this a bug or am I doing something wrong ?
Obviously I trimmed my code for my example here, the actual Custom Upload result embeds 19 variables and everything worked perfectly until I add this SourceFilePath string to it.
Any clue ? Looks like '\' isn't supported.
Cheers,
Chris
I have been using the Upload control for quite a while now using my own custom AsyncUploadResult class.
What happens now is unexpected as I'm trying to save the absolute path to the uploaded file into a string variable and this ends up in a error thrown statint the escape sequence is not recognized. See below :
My custom upload class :
1.
public
class
DataUploadResult : AsyncUploadResult
2.
{
3.
private
string
sourceFilePath;
4.
public
string
SourceFilePath {
get
{
return
this
.sourceFilePath; }
set
{
this
.sourceFilePath = value; } }
5.
}
My UploadHandler:
1.
protected
override
IAsyncUploadResult Process(UploadedFile file, HttpContext context, IAsyncUploadConfiguration configuration,
string
tempFileName)
2.
{
3.
DataUploadResult result = CreateDefaultUploadResult<DataUploadResult>(file);
4.
result.SourceFilePath =
string
.Format(@
"{0}\{1}"
, configuration.TempTargetFolder, tempFileName);
5.
}
return result;
And my FileUploaded event Handler;
1.
protected
void
RauDataUpload_OnFileUploaded(
object
sender, FileUploadedEventArgs e)
2.
{
3.
DataUploadResult result = e.UploadResult
as
DataUploadResult;
4.
}
And it fails on row 3 with the following error message:
"Exception has been thrown by the target of an invocation."
Unrecognized escape sequence. (430): {"SourceFilePath":"C:\Dev\NRP\NRP\Study\UploadTemp\1411349019322101001_20140410-125730_PTAP.sld"}
Is this a bug or am I doing something wrong ?
Obviously I trimmed my code for my example here, the actual Custom Upload result embeds 19 variables and everything worked perfectly until I add this SourceFilePath string to it.
Any clue ? Looks like '\' isn't supported.
Cheers,
Chris