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

(Very) Weird AllowedFileExtensions Problem

4 Answers 62 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
-DJ-
Top achievements
Rank 1
-DJ- asked on 15 Apr 2009, 03:11 PM

Hi guys,

This problem I'm facing is so weird that I cannot really believe it.

1    Dim intRows As Integer = ds.Tables(0).Rows.Count() 
2    upload.AllowedFileExtensions = New String(intRows) {} 
3    Dim x As Integer 
4    For Each row As DataRow In ds.Tables(0).Rows 
5        'upload.AllowedFileExtensions.SetValue("." & row("FileTypeEnding"), x) 
6        upload.AllowedFileExtensions.SetValue(row("FileTypeEnding"), x) 
7        x += 1 
8    Next 

On my dev machine, running XP and IIS 5, line 6 works as expected.
But not on my server, running Server 2003 and IIS 6. There it's line 5 that works correctly.

Can you believe it?

Regards,
-DJ-

4 Answers, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 20 Apr 2009, 07:35 AM
Hi -DJ-,

That's a very interesting one!

I haven't come across such a behavior, but it could possibly be related to some environment setting on the server. FYI, I've always used the syntax with a dot and it has worked correctly. You could try something like File.GetExtension("." & row("FileTypeEnding"))...

Just to make sure, can you check if you have the same entries (with a leading dot) on both the server and the development machines?

Kind regards,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
-DJ-
Top achievements
Rank 1
answered on 22 Apr 2009, 10:29 AM
Hi Erjan,

I think that everything I said was total nonsense.
Looks like the DB's I was working with weren't identical, one actually had a dot before the extension while the other one didn't, which would explain this :)

However, I'm still experiencing some problems with the upload control.
More times than not I get this error:

[NullReferenceException: Object reference not set to an instance of an object.] 
   Telerik.Web.UI.RadUpload.IsValidExtension(UploadedFile file) +141 
   Telerik.Web.UI.RadUpload.IsValidUploadedFile(UploadedFile file, Boolean checkingFileSize, Boolean checkingFileExtension, Boolean checkingMimeType) +135 
   Telerik.Web.UI.RadUpload.ValidateUploadedFiles() +217 
   Telerik.Web.UI.RadUpload.OnLoad(EventArgs e) +13 
   System.Web.UI.Control.LoadRecursive() +47 
   System.Web.UI.Control.LoadRecursive() +131 
   System.Web.UI.Control.LoadRecursive() +131 
   System.Web.UI.Control.LoadRecursive() +131 
   System.Web.UI.Control.LoadRecursive() +131 
   System.Web.UI.Control.LoadRecursive() +131 
   System.Web.UI.Control.LoadRecursive() +131 
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436 
 

Which seems to be related to some embedded checking that I really have no use for. I do validate the type and size myself, so how can I get passed this point without using the built in checking?

Regards,
-DJ-
0
Atanas Korchev
Telerik team
answered on 23 Apr 2009, 03:12 PM
Hi -DJ-,

If you are validating the files by yourself you can just skip setting the AllowedFileExtensions property. Anyway you may have discovered a bug which we should reproduce and fix. Could you please give us more details about the case which is causing the NullReferenceException? Thanks.

Regards,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
-DJ-
Top achievements
Rank 1
answered on 23 Apr 2009, 03:42 PM
Hi Albert,

I will prepare a demo project and submit a support ticket, given that the problem will still be existing there. If not maybe I'll discover the reason for the error and post it here.

Regards,
-DJ-
Tags
Upload (Obsolete)
Asked by
-DJ-
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
-DJ-
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or