RadUpload1.UploadedFiles.Count = 0

Thread is closed for posting
18 posts, 0 answers
  1. Wack
    Wack avatar
    11 posts
    Member since:
    Nov 2006

    Posted 05 Aug 2008 Link to this post

    I have a rad upload on a user control and i cannot upload my files because after debugging, i found that RadUpload1.UploadedFiles.Count = 0.  i've looked at the examples and I'm at a loss.  My code is below.  What am I missing?

    ASPX
    <telerik:RadUpload ID="RadUpload1" runat="server" EnableEmbeddedSkins="false" Skin="Hay2" InitialFileInputsCount="3" ControlObjectsVisibility="All" InputSize="75" Width="700px" />

    C#
    if (RadUpload1.UploadedFiles.Count > 0)
    {
        foreach (UploadedFile validFile in RadUpload1.UploadedFiles)
    {
        string targetFolder = Server.MapPath("/attachments/");
        validFile.SaveAs(
    Path.Combine(targetFolder, validFile.GetName()), true);
    }
    labelNoResults.Visible =
    false;
    repeaterValidResults.Visible =
    true;
    repeaterValidResults.DataSource = RadUpload1.UploadedFiles;
    repeaterValidResults.DataBind();
    }
    else
    {
    labelNoResults.Visible =
    true;
    repeaterValidResults.Visible =
    false;
    }
  2. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 06 Aug 2008 Link to this post

    Hi Wack,

    Could it be that you've placed RadUpload to a RadAjaxPanel/UpdatePanel or used RadAjaxManager to ajaxify it? Please, check the Uploading Files with Ajax page for more information on the matter.

    Kind regards,
    Erjan Gavalji
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. David Balderree
    David Balderree avatar
    10 posts
    Member since:
    Apr 2007

    Posted 12 Aug 2008 Link to this post

    This isn't working for me either.  I have nothing ajaxified, I'm using a standard file input, and the RadUploadContext.Current.UploadedFiles.Count is always 0.  I've tried it on the demo site here and can't get anything to upload in Firefox or IE. 

  5. Amanda
    Amanda avatar
    24 posts
    Member since:
    Apr 2007

    Posted 13 Aug 2008 Link to this post

    I am having the same problem - I am using the RadUpload control twice in my application, and one works and the other does not.  The demo site does not work for me either.  What's up with this?  The only difference between my two uses of the RadUpload are that the one that works permits only one file to be uploaded - the broken one allows more than one.
  6. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 15 Aug 2008 Link to this post

    Hi guys,

    I could not reproduce the problem at my side. Please find my sample page which demonstrates that it works correctly. Please download it and give it a try.

    Are you running your application under IIS 7? If so, make sure you have the appropriate values set in the web.config as described in the help articles:
    http://www.telerik.com/help/aspnet-ajax/upload_configurationraduploadhttpmodule.html
    http://www.telerik.com/help/aspnet-ajax/upload_configurationraduploadprogresshandler.html

    Also, do you have any file validations set?

    Kind regards,
    Veskoni
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. David Balderree
    David Balderree avatar
    10 posts
    Member since:
    Apr 2007

    Posted 15 Aug 2008 Link to this post

    Thanks for your help on this.  It seems to work fine when using UploadedFiles on a RadUpload object but when I use RadUploadContext.Current.UploadedFiles (I'm using standard file inputs) the Count is still always 0.  This happens in your example project also when changing all the RadUpload1 references to RadUploadContext.Current.  Does the following page work for you?
    http://www.telerik.com/DEMOS/ASPNET/Prometheus/Upload/Examples/StandardFileInputs/DefaultCS.aspx?RadUrid=95c14402-46f5-47bb-9df3-440cb5eaa9e5
    Thanks!
    David
  8. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 18 Aug 2008 Link to this post

    Hello David,

    This will be fixed in the official service pack 1 scheduled for next week.

    In the meantime you can use:

    private void BindResults()  
    {  
        if (Request.Files.Count > 0)  
        {  
          divResults.Visible = true;  
          labelNoResults.Visible = false;  
     
             labelRes1.Text = UploadedFile.FromHttpPostedFile(Request.Files[0]).FileName;  
             labelRes2.Text = UploadedFile.FromHttpPostedFile(Request.Files[1]).FileName;  
             labelRes3.Text = UploadedFile.FromHttpPostedFile(Request.Files[2]).FileName;  
    ... 

    I hope this helps.

    Sincerely yours,
    Veskoni
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  9. David Balderree
    David Balderree avatar
    10 posts
    Member since:
    Apr 2007

    Posted 18 Aug 2008 Link to this post

    That did the trick for me, thanks!
  10. Denny
    Denny avatar
    13 posts
    Member since:
    May 2008

    Posted 16 Sep 2008 Link to this post

    Hi, I have same problem but it only happen when browsing with Opera 9.51. It happen on your demo as well:
     http://demos.telerik.com/ASPNET/Prometheus/Upload/Examples/StandardFileInputs/DefaultCS.aspx?RadUrid=95c14402-46f5-47bb-9df3-440cb5eaa9e5 

    I am using version 2008.2.826.35. Is this version include the service pack 1?

    thanks

    Denny
  11. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 17 Sep 2008 Link to this post

    Hello Denny,

    I checked that example under Opera 9.52 and everything is working fine. What exactly is the problem that you face?

    Version 2008.2.826 is the Q2 SP1 version.


    Kind regards,
    Veskoni
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  12. Denny
    Denny avatar
    13 posts
    Member since:
    May 2008

    Posted 18 Sep 2008 Link to this post

    While I try to upload a 1.98mb jpg file using opera(9.51) on your demo page, as soon as I hit "Submit" button, it shows File input1: default.htm instantly on the right. If I do the same using IE or FF, it will show up a progress bar.

    I have then upgrade my opera to 9.52, now the file can upload but without showing the progress bar.

    Regards,
    Denny
  13. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 23 Sep 2008 Link to this post

    Hi Denny,

    Indeed, the current implementation of RadProgressArea does not work in Opera, although the upload works fine. I'm glad to note that Opera progress will be available in the official RadControls for ASP.NET Ajax Q3 2008 release. The release is scheduled for the end of October.

    Please, bear with us some more.

    Kind regards,
    Erjan Gavalji
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  14. Hrvoje
    Hrvoje avatar
    1 posts
    Member since:
    Dec 2008

    Posted 10 Feb 2009 Link to this post

    I spent almost whole day, searching for the solution to that problem.
    1. If the RadUpload  control is inside of the Ajax Panel you should consider workarounds, mentioned by Telerik support.
    2. A second, most difficult to find, problem can be resolved if you leave all default properties of RadUpload control (don't change anything).
    If it is working, try explore every property, one by one, and you'll find the solution.

    My solution was:
    AllowedFileExtensions="jpeg, jpg, gif, png"            <- Wrong code
    AllowedFileExtensions=".jpeg,.jpg,.png,.gif"           <- Correct code

    Put following code inside aspx.vb file (if you're using VB.Net) to debug it quickly:

       Protected Sub btnSavePhoto_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSavePhoto.Click
            MsgBox(Me.RadUpload1.UploadedFiles.Count.ToString)
       End Sub





  15. Yap
    Yap avatar
    2 posts
    Member since:
    Mar 2009

    Posted 14 Apr 2009 Link to this post

    I have the same problem, when I added the AllowedFileExtensions for the RadUpload, the UploadedFiles.count = 0
    If I remove the AllowedFileExtensions, it wok fine.

    What is the problem? Anyone tell me please. Thank in advanced.
  16. Del Olds
    Del Olds avatar
    1 posts
    Member since:
    Nov 2009

    Posted 17 Nov 2009 Link to this post

    I also removed AllowedFileExtensions  and that fixed my issue. Specifically I could upload JPG and GIF and not PNG. I didn't try different ways of putting the extensions in the filter (different formatting), but I am guessing that is the problem or the routine is just returning 0 when you use the allowedfileextsnions.  By the way, no AJAX panels involved either.
  17. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 20 Nov 2009 Link to this post

    Hello Del Olds,

    Do you use the correct syntax of a comma delimited list of the file extensions? Does the file that you upload meets those extensions? If it is not in the UploadedFiles collection it should be in the InvalidFiles collection

    Greetings,
    Veselin Vasilev
    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.
  18. Rupesh
    Rupesh avatar
    1 posts
    Member since:
    Jul 2012

    Posted 05 Jul 2012 Link to this post

    How to nullify the ajax for the rad upload control added dynamically?

    User control is added to the asp.net on fly having the radupload control, that shows file count 0 despite uploading the file. The usercontrol had a sublit button and radupload that is being added on fly to the asp page.

    i used script on the usercontrol

        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
            <script type="text/javascript">
                // on upload button click temporarily disables ajax to perform
                // upload actions
                function conditionalPostback(sender, args) {
                    if (args.get_eventTarget() == "<%= btnInsert.UniqueID %>") {
                   
                        args.set_enableAjax(false);
                    }
                }
            </script>
            </telerik:RadScriptBlock>
    and on aspx page having the ajax

        <telerik:RadAjaxPanel ID="rap1" runat="server" clientevents-onrequeststart="conditionalPostback">

    but on submit click the script get hit in the end of data submit but do not nullify the ajax, where i am wrong please help me, i am in dire need of solution.
  19. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 10 Jul 2012 Link to this post

    Hello Rupesh,

    I reviewed your code snippet and compared it to the following help article and everything seems to be fine. Could you please open a new support thread and send me a runnable sample project for a local test?

    Regards,
    Peter Filipov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017