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

RadProgressManager with radupload in safari 3 .flp file upload error

8 Answers 65 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Vijaykumar
Top achievements
Rank 1
Vijaykumar asked on 22 Oct 2008, 05:40 AM

 I use RadProgressManager and RadProgressArea  with the rad upload control. it works fine in all browsers except safari 3 and above. This happend especially when i try to upload .flp and .cwk  files.

If i upload a .doc or .txt file it works fine.

Please share some light on this.

----------------- Sample Code --------

<body>
<form id="form1" runat="server">
<div>
<label for="RadUploadMainFile0"><asp:Literal ID="ltlMainFile" runat="server" Text="file to upload: <span class='formalert'>*</span>" meta:resourcekey="lblMainFileResource1"></asp:Literal>
<asp:CustomValidator ID="MainFile" runat="server" ErrorMessage="You must select a main file."
ClientValidationFunction="Check" OnServerValidate="MainFile_ServerValidate" Display="Dynamic" CssClass="ErrorMessage" ForeColor="" ></asp:CustomValidator>
</label>
<radU:RadUpload ID="RadUpload" runat="server" ControlObjectsVisibility="None" OnClientFileSelected="SelectedFile" LocalizationPath="~/RadControls/Upload/Localization" ></radU:RadUpload>
<div ><asp:Literal ID="ltrFileName" runat="server" Text="Filename: " ><asp:Label id="lblFileName" runat="server" asp:Label></div>

<radU:RadProgressManager ID="Radprogressmanager1" runat="server" meta:resourcekey="Radprogressmanager1Resource1" />
<radU:RadProgressArea ID="progressArea1" runat="server" ProgressIndicators="TotalProgress, TotalProgressPercent, RequestSize, CurrentFileName" DisplayCancelButton="True" SkinsPath="Non-existingPath" meta:resourcekey="progressArea1Resource1" Language="" LocalizationPath="h:\RadControls\Upload//Localization" >
</radU:RadProgressArea>
<br />
<asp:Button ID="Button1" runat="server" Text="Button" Visible="true" OnClick="Button1_Click" /></div>
</form>
</body>

 

8 Answers, 1 is accepted

Sort by
0
Vijaykumar
Top achievements
Rank 1
answered on 22 Oct 2008, 06:33 AM
Code behind for the above aspx page

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class TelerikUpLoadFile : System.Web.UI.Page
{
private const string PAGEKEY = "File";
protected void Page_Load(object sender, EventArgs e)
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), PAGEKEY, GetClientSideScript());
if (!Page.IsPostBack)
{
if (!string.IsNullOrEmpty(Request.Params.Get("__EVENTARGUMENT"))
&& Request.Params.Get("__EVENTARGUMENT") == "FileUpload")
{
if ((RadUploadMain.UploadedFiles.Count > 0) && (RadUploadMain.UploadedFiles[0].ContentLength > 0))
{
lblFileName.Text = "Using telerik file is Uploaded: ";
}
}
}
}

private String GetClientSideScript()
{

string javascript = @"
<script language='javascript' type='text/javascript'>

var upLoadPath = '';
var upLoadFileName = '';
var isFileNameOnly = false;
// Updates the label lblFileName when the Uploadfile is selected
function FileSelected(radUpload, eventArgs)
{ alert('FileSelected');
upLoadPath = eventArgs.FileInputField.value;
alert('FileSelected2');
//extracts the file and path separately and returns them
var fileInfo = extractFileInfo(upLoadPath);
alert('fileInfo ' + fileInfo);
if(fileInfo.file != null)
upLoadFileName = fileInfo.file;
else
{
upLoadFileName = upLoadPath;
isFileNameOnly = true;
}
document.getElementById('lblFileName').innerHTML = upLoadFileName;

ValidatorValidate(CVMainFile);

document.getElementById('lblFileName').innerHTML = upLoadFileName;

//PostBack('','FileUpload');

}


//Checks wether the file is selected.
function FileCheck(source,args)
{
// Check any files is selected through the upload control
if( (upLoadFileName.length) > 0 )
{
document.getElementById('lblFileName').innerHTML = upLoadFileName;
args.IsValid = true;
}
// if Save button is clicked then the upLoadFileName.length will be zero
// and lblFileName.length willbe greater than zero.
else if(document.getElementById('lblFileName').innerHTML.length > 0)
{
args.IsValid = true;
}
else
{
"
+ RadUploadMain.ClientID + @".ClearFileInputAt(0);
document.getElementById('lblFileName').innerHTML = '';
upLoadFileName = '';
upLoadPath = '';
args.IsValid = false;
}
}
//The method forcefully post back, in order to upload files the
//whole form must be submitted.
function PostBack(eventTarget, eventArgument)
{
alert('fof');
__doPostBack(eventTarget, eventArgument);
return false;
}
function extractFileInfo(filePath)
{
var fileInfo = filePath.match(/(.*)[\/\\]([^\/\\]+\.\w+)$/);
if (fileInfo == null) {
return {path: null, file: null};
}
else {
return {path: fileInfo[1], file: fileInfo[2]}
}
}
</script>
";
// return the javascript
return javascript;
}

protected void CVMainFile_ServerValidate(object source, ServerValidateEventArgs args)
{
try
{
if ((RadUploadMain.UploadedFiles.Count > 0))
{
lblFileName.Text = "file copied sussessfully";
args.IsValid = true;
}

else
{
lblFileName.Text = "Error Error Error";
args.IsValid = false;
}
}
catch (Exception ex)
{

throw ex;

}

}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
if ((RadUploadMain.UploadedFiles.Count > 0))
{
lblFileName.Text = "file copied sussessfully through button click";
}

else
{
lblFileName.Text = "Error occured on button click";
}
}
catch (Exception ex)
{

throw ex;

}
}
}
0
Erjan Gavalji
Telerik team
answered on 22 Oct 2008, 08:37 AM
Hi Vijaykumar,

Indeed, we found that the Safari browser (on Mac) fails uploading some types of files. To my regret we could not find the reason for that.

I believe it is a matter of a browser (or client computer) configuration though, because it is not persistent - we identified a case where we could upload one file from a machine and could not upload the same file from another machine (both uploads done from a Safari on Mac).

Regards,
Erjan Gavalji
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Vijaykumar
Top achievements
Rank 1
answered on 22 Oct 2008, 11:28 AM
Hi Erjan Gavalji,
Thanks for the quick reply.
In my case i dont think it is safari 3.x browser settings issue.

File upload of any type works fine in safari 2.x browsers.

In Safari 3.x browser -  except .flp and .cwf file i can able to upload all other file type.

In order to make .flp and .cwk file work in safari 3.x browser i removed the RadProgressManager  and RadProgressArea  code from the aspx file, To my suprise it uploads fine.

Could you please help to sort this issue.


regards
Vijay



0
Erjan Gavalji
Telerik team
answered on 22 Oct 2008, 12:05 PM
Hi Vijaykumar,

This is interesting indeed. To my regret we were not able to reproduce this problem with fake .flp and .cwf files.

Can you please attach the real problematic files to a formal support ticket so that we can use them for testing? We will do our best to have the issue solved once we are able to reproduce the problem on our side.

Kind regards,
Erjan Gavalji
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Vijaykumar
Top achievements
Rank 1
answered on 22 Oct 2008, 12:15 PM
Hi,
Could you please help me how can i upload a sample file with this message. I am trying to send you the samples but i could not find a attach button in this screen.

Thanks
Vijay
0
Erjan Gavalji
Telerik team
answered on 22 Oct 2008, 12:19 PM
Hi Vijaykumar,

To preserve confidentiality, attachments are not allowed to the public forums. Please, open a support ticket for that.

Best,
Erjan Gavalji
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Vijaykumar
Top achievements
Rank 1
answered on 23 Oct 2008, 06:29 AM
I have opened support ticket  and mailed you the sample code in which the sample files are also present.
Hope you will be able to point me the right suggustion/solution to this issue.
0
Veselin Vasilev
Telerik team
answered on 27 Oct 2008, 03:32 PM
Hello Vijaykumar,

We could not reproduce the problem at our side. We have attached a video showing our local tests.

Best wishes,
Veselin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Upload (Obsolete)
Asked by
Vijaykumar
Top achievements
Rank 1
Answers by
Vijaykumar
Top achievements
Rank 1
Erjan Gavalji
Telerik team
Veselin Vasilev
Telerik team
Share this question
or