Problem getting File Selected Programmatically

4 posts, 0 answers
  1. malebo
    malebo avatar
    7 posts
    Member since:
    Feb 2009

    Posted 30 Mar 2009 Link to this post


    I'm creating  the Uploader control programmatically.

    And using FilesSelected event.

    The problem  is that i'm unable to access the file fullName inside FilesSelected  event

     It gives me this error:
    +  e.SelectedFiles[0].File.FullName 'e.SelectedFiles[0].File.FullName' threw an exception of type 'System.Security.SecurityException' string {System.Security.SecurityException}

    Please help

  2. Ivan
    Ivan avatar
    519 posts

    Posted 31 Mar 2009 Link to this post

    Hello malebo,

    Thank you for your interest in the RadUpload control.

    About the FullName of uploaded files - there is a reason for this exception. Silverlight cares about the system security. Let us look a bit deeper in the Silverlight code. You are trying to access the FullName property of the FileSystemInfo class but it is marked as "[SecurityCritical]". Bellow is the declaration of this class:

    public abstract class FileSystemInfo  
        // Methods  
        protected FileSystemInfo();  
        public abstract void Delete();  
        public void Refresh();  
        // Properties  
        public FileAttributes Attributes { [SecurityCritical] get; [SecurityCritical] set; }  
        public DateTime CreationTime { [SecurityCritical] getinternal [SecurityCritical] set; }  
        internal DateTime CreationTimeUtc { [SecurityCritical] get; [SecurityCritical] set; }  
        internal string DisplayPath { getset; }  
        public abstract bool Exists { [SecuritySafeCritical] get; }  
        public string Extension { [SecuritySafeCritical] get; }  
        public virtual string FullName { [SecurityCritical] get; }  
        public DateTime LastAccessTime { [SecurityCritical] getinternal [SecurityCritical] set; }  
        internal DateTime LastAccessTimeUtc { [SecurityCritical] get; [SecurityCritical] set; }  
        public DateTime LastWriteTime { [SecurityCritical] getinternal [SecurityCritical] set; }  
        internal DateTime LastWriteTimeUtc { [SecurityCritical] get; [SecurityCritical] set; }  
        public abstract string Name { [SecuritySafeCritical] get; }  

    Hope this information helps.

    All the best,
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. DevCraft R3 2016 release webinar banner
  4. malebo
    malebo avatar
    7 posts
    Member since:
    Feb 2009

    Posted 31 Mar 2009 Link to this post

    I thought as much Thanks for the response.
  5. Moshe Flam
    Moshe Flam avatar
    1 posts
    Member since:
    Oct 2009

    Posted 01 Feb 2010 Link to this post

    You can catch the file that was set by the user during the OnFileSelectedChange.
    (See the web for "preview image client side telerik uploader"... 
     The latest telerik code uses the eventArgs.get_fileInputField().value; )
    and store it in a global javascript var. ) Now you have it for further calls to web services.

    For codebehind its simply RadUpload1.UploadedFiles[0].Filename;
    of course if the UploadedFiles has a count.
Back to Top