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

RadUpload1.UploadedFiles.Count = 0

17 Answers 1241 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Wack
Top achievements
Rank 1
Wack asked on 05 Aug 2008, 06:39 PM
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;
}

17 Answers, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 06 Aug 2008, 03:06 PM
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.
0
Recursor
Top achievements
Rank 1
answered on 12 Aug 2008, 11:46 PM
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. 

0
Amanda
Top achievements
Rank 1
answered on 13 Aug 2008, 06:43 PM
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.
0
Veselin Vasilev
Telerik team
answered on 15 Aug 2008, 01:47 PM
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.
0
Recursor
Top achievements
Rank 1
answered on 15 Aug 2008, 07:54 PM
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
0
Veselin Vasilev
Telerik team
answered on 18 Aug 2008, 09:08 AM
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.
0
Recursor
Top achievements
Rank 1
answered on 19 Aug 2008, 12:35 AM
That did the trick for me, thanks!
0
Denny
Top achievements
Rank 2
answered on 16 Sep 2008, 05:32 PM
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
0
Veselin Vasilev
Telerik team
answered on 17 Sep 2008, 07:04 AM
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.
0
Denny
Top achievements
Rank 2
answered on 18 Sep 2008, 10:39 AM
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
0
Erjan Gavalji
Telerik team
answered on 23 Sep 2008, 01:24 PM
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.
0
Hrvoje
Top achievements
Rank 1
answered on 10 Feb 2009, 01:18 PM
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





0
Yap
Top achievements
Rank 1
answered on 14 Apr 2009, 09:06 AM
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.
0
Del Olds
Top achievements
Rank 1
answered on 17 Nov 2009, 06:39 PM
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.
0
Veselin Vasilev
Telerik team
answered on 20 Nov 2009, 08:56 AM
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.
0
Rupesh
Top achievements
Rank 1
answered on 05 Jul 2012, 08:57 AM
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.
0
Peter Filipov
Telerik team
answered on 10 Jul 2012, 07:37 AM
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.
Tags
Upload (Obsolete)
Asked by
Wack
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
Recursor
Top achievements
Rank 1
Amanda
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Denny
Top achievements
Rank 2
Hrvoje
Top achievements
Rank 1
Yap
Top achievements
Rank 1
Del Olds
Top achievements
Rank 1
Rupesh
Top achievements
Rank 1
Peter Filipov
Telerik team
Share this question
or