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

Problem radUpload published

3 Answers 106 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Paloma
Top achievements
Rank 1
Paloma asked on 10 Nov 2009, 07:55 AM
Hi there!
I've done an application that has a radUpload control. If I try the control in my local machine I'm able to upload, save and open the files. But when I publish the application I try to upload a file and I get the 0% uploading state and the file never gets uploaded.
Some ideas???
Thanks in advance
Paloma

3 Answers, 1 is accepted

Sort by
0
Ivan
Telerik team
answered on 10 Nov 2009, 09:31 AM
Hi Paloma,

Thank you for interest in the RadUpload for Silverlight.

There are few reasons that correspond to your case.
  • Absolute Path for upload handler.
    If you initialize the UploadServiceUrl property with a full-path value like:
        UploadServiceUrl = "http://localhost:6242/MyUploadHandler.ashx"
    the you will not be able to access it after the deployment.
    To resolve this issue you should use a relative path:
        UploadServiceUrl = "~/MyUploadHandler.ashx"
  • Upload Storage directory.
    Check the existence of the storage directory. Ensure the upload handler has credentials to write in it.
    Actually there are two properties to set the name of the storage directory:
    • TargetFolder: use this property if the storage folder is relative to the upload handler.
    • TargetPhysicalFolder: use this one with full path of the storage folder. 
  • Medium Trust.
    If your Upload Handler is deployed at location with Medium Trust level, please follow instructions in the Medium Trust and the RadUpload for Silverlight article.

Please check your application against the list above. If the still persists please write us back with more details about the control's initialization and the deployment settings.

Greetings,
Ivan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Paloma
Top achievements
Rank 1
answered on 10 Nov 2009, 12:58 PM
Hi there!
I've tried all your propositions but I get the same 0% uploading.
I've put a breakpoint into the ashmx code and when I try the application in my local machine it stops there, but when I execute the published application I'm not able to stop there by using the remote treatment.
I have the "UserUploads" destination created in my web project.
I have defined the relative path for the TargetFolder resource. But I get the same "non" error (0% uploading)
I paste you my code:
XAML Code

 

<UserControl.Resources>
 <system:String x:Key="UploadServiceUrl">~/RadUploadHandler.ashx</system:String>
 <system:String x:Key="TargetFolder">UserUploads</system:String>
</UserControl.Resources>
<input:RadUpload x:Name="upldFichero" Height="Auto" 
         Filter="All Files (*.*)|*.*|Image Files (*.gif;*.jpg;*.jpeg;*.png)|*.gif;*.jpg;*.jpeg;*.png|Text Files          (*.txt;*.doc;*.pdf;*.docx;*.xsl;*xslx)|*.txt;*.doc;*.pdf;*.docx;*.xsl;*xslx"
         IsAutomaticUpload="false" IsMultiselect="True"
         MaxFileCount="2"
         IsDeleteEnabled="True"
         OverwriteExistingFiles="True"
         HorizontalAlignment="Left"
         VerticalAlignment="Top"
         FilterIndex="0"
         Language="ES-es"
         UploadServiceUrl="{StaticResource UploadServiceUrl}"
         TargetFolder="{StaticResource TargetFolder}"
         MaxFileSize="9437184"
         MaxUploadSize="9437184"
         FileUploaded="upldFichero_FileUploaded"
         FileTooLarge="upldFichero_FileTooLarge"
         Width="500"/>

 

ASHX Code:
 

public class RadUploadHandler : Telerik.Windows.RadUploadHandler
{
         public override void ProcessStream()
         {
            base.ProcessStream();
         }
 

         public override System.Collections.Generic.Dictionary<string, object> GetAssociatedData()
         {
            System.Collections.Generic.Dictionary<string, object> dict = new System.Collections.Generic.Dictionary<string, object>();
            dict.Add("FileName", this.Request.Form["RadUAG_filename"]);
            string ruta = AppDomain.CurrentDomain.BaseDirectory + "UserUploads\\" + this.Request.Form["RadUAG_filename"];
            System.IO.FileStream fs = new System.IO.FileStream(ruta, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read);  
            System.IO.BinaryReader br = new System.IO.BinaryReader(fs, System.Text.Encoding.Default);
            byte[] documento;
            documento= br.ReadBytes((int)fs.Length);
            br.Close(); 
            fs.Close();
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            foreach (byte b in documento)
             sb.Append(b).Append("|");
            dict.Add("Data", sb.ToString()); 
            return dict;  
 
         }

}

 

 

 

0
Ivan
Telerik team
answered on 11 Nov 2009, 12:01 PM
Hello Paloma,

Thank you for the detailed information.

After answering your previous post we started a new KB article - Troubleshooting the RadUpload for Silverlight. It contains two new topics: Cross-Domain issue and Window 7 Security Exception. Could you please follow the article and after that to drop us a line about the state at your side.

Regards,
Ivan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Upload
Asked by
Paloma
Top achievements
Rank 1
Answers by
Ivan
Telerik team
Paloma
Top achievements
Rank 1
Share this question
or