Check Raduploads Buffersize Property Remarks

2 posts, 0 answers
  1. Christian Wilson
    Christian Wilson avatar
    2 posts
    Member since:
    May 2010

    Posted 12 Feb 2014 Link to this post

    I'm getting this error along with other information when uploading a file in my silverilght app.
    it also states:
    Handler not found or execution of the handler failed!
    Arguments: NotFound

    What am i doing wrong?
    I am selecting a file, when i click upload the file is converted client side, then uploaded to the server. Before it gets there this error happens.
    here is the code for my radupload

    <telerik:RadUpload x:Name="RadUpload1"
                                       Height="138"
                                       AllowDrop="True"
                                       Filter="Image Files (*.jpg;*.jpeg;*.gif;*.png) |*.jpg; *.jpeg; *.png; *.gif"
                                       IsMultiselect="False"
                                       IsPauseEnabled="False"
                                       TargetFolder="~/UserUploads"
                                       MaxFileSize="50000000000000"
                                       UploadServiceUrl="~/GenericHandler.ashx"
                                       BufferSize="3000000"
                                       MaxFileCount="1"
                                       FileUploaded="RadUpload_FileUploaded"
                                       VerticalAlignment="Center"
                                       Margin="50,0,272,0" HorizontalAlignment="Left"
                                       FilesSelected="RadUpload1_FilesSelected"
                                       FileUploadStarting="RadUpload1_FileUploadStarting"
                                        />



    Here is my C# event

    private void RadUpload1_FileUploadStarting(object sender, Telerik.Windows.Controls.FileUploadStartingEventArgs e)
            {
                Telerik.Windows.Controls.RadUploadSelectedFile file = e.SelectedFile as Telerik.Windows.Controls.RadUploadSelectedFile;
                BitmapImage bimg = new BitmapImage();
                bimg.SetSource(e.SelectedFile.File.OpenRead());
                WriteableBitmap bmp = getImageSource(e.SelectedFile.File.OpenRead(), 600, 600);
                byte[] buffer;
                using (Stream Source = JpgEncoder.Encode(bmp, 100))
                {
                    int bufferSize = Convert.ToInt32(Source.Length);
                    buffer = new byte[bufferSize];
                    Source.Read(buffer, 0, bufferSize);
                    Source.Close();
                }
                ServiceReference1.HazardWCFServiceClient service = new ServiceReference1.HazardWCFServiceClient();
                
                service.saveImageAsync(buffer, "correct location on server" +  e.SelectedFile.Name);
      
                //NOTE: use the buffer to show the image...
      
                e.NewFileStream = new MemoryStream(buffer);
            }
    private void RadUpload_FileUploaded(object sender, Telerik.Windows.Controls.FileUploadedEventArgs e)
           {
               bool status = false;
                
                   string path = RadUpload1.TargetFolder.Substring(1) + "/" + e.SelectedFile.Name;
                    
                   IMAGE_HDR ss = new IMAGE_HDR(); //instantiate new instance of the table
                   ss.IMG_PATH = path;
                   ss.IMG_NAME = tb_name.Text;
                   ss.IMG_ENABLED = true;
                   ss.IMG_DESC = tb_desc.Text;
                   ss.IMG_CREATED = DateTime.Now;
                   ss.CAT_ID = 1;//default category DO NOT DELETE THIS ROW!
                   _OrganizationContext.IMAGE_HDRs.Add(ss);
                   try
                   {
                       _OrganizationContext.SubmitChanges();
                       status = true;
                       PathToImage = path;
                   }
                   catch (Exception ex)
                   {
                       status = false;
                       MessageBox.Show(ex.Message);
                   }
                     
                                       
                       //File uploaded successfully move to next step. Load the most recent key entered.
                       _OrganizationContext.Load(this._OrganizationContext.getLastImageKeyQuery(), (op) =>
                       {
                           IMAGE_HDR key = op.Entities.First();
                           imageKey = Convert.ToInt32(key.IMG_KEY.ToString()); //async not done loading?
                       }, null).Completed += Create_Completed; //add completed event to move on after the assignment is done.
                     
                   
           }
  2. Christian Wilson
    Christian Wilson avatar
    2 posts
    Member since:
    May 2010

    Posted 13 Feb 2014 in reply to Christian Wilson Link to this post

    I figured it out. The Web service handler .ashx in the radupload properties was a relative URL. I read on another forum post that it had to be an absolute URL for it to work.
  3. DevCraft banner
Back to Top