FileBytes

3 posts, 1 answers
  1. Jim
    Jim avatar
    42 posts
    Member since:
    Mar 2009

    Posted 22 Feb 2010 Link to this post

    We are using a virus checking service that accepts the filebytes from the file upload control as a parameter. How would I access this in the ItemCommand in the looping statement?

    If I can't do it, is it possible to override the default upload control and use a regular file upload component?
    RadFileExplorer explorer = sender as RadFileExplorer;  
    foreach (UploadedFile file in explorer.Upload.UploadedFiles)  
    {  
        bool bFileIsVirusFree = Helper.IsFileVirusFree(file.FileBytes);
  2. Answer
    Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 25 Feb 2010 Link to this post

    Hi Jim,

    In your case you can use this approach:
    protected void RadFileExplorer1_ItemCommand(object sender, RadFileExplorerEventArgs e)
    {
        RadFileExplorer explorer = sender as RadFileExplorer;
        foreach (UploadedFile file in explorer.Upload.UploadedFiles)
        {
            byte[] fileBytes = new byte[file.ContentLength];
            file.InputStream.Read(fileBytes, 0, file.ContentLength);
            bool bFileIsVirusFree = Helper.IsFileVirusFree(fileBytes);
        }
    }

    I hope this helps.

    Best wishes,
    Fiko
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Jim
    Jim avatar
    42 posts
    Member since:
    Mar 2009

    Posted 01 Mar 2010 Link to this post

    yep,
    byte[] fileBytes = new byte[file.ContentLength];  
    file.InputStream.Read(fileBytes, 0, file.ContentLength);  
     
    I was not getting a correct result because of an unrelated serivice bug in our code. Thanks.
Back to Top