Disabled Upload button

7 posts, 0 answers
  1. Jermaine
    Jermaine avatar
    13 posts
    Member since:
    Feb 2013

    Posted 12 Mar 2014 Link to this post

    I am not able to perform uploads after setting up the upload, view, and initial paths in the page load of the solution.  The file explorer shows the initial path and I am able to navigate folders and select files.  I am using your Telerik example here .  What am I missing?  How can I initiate a download to the .ashx handler file identified in the MappingFile.mapping configuration file?  Thanks in advance.
  2. Jermaine
    Jermaine avatar
    13 posts
    Member since:
    Feb 2013

    Posted 12 Mar 2014 in reply to Jermaine Link to this post

    My code can be previewed here and the html code follows:

    01.<telerik:RadFileExplorer ID="RadFileExplorerReceive" runat="server"
    02.                       EnableOpenFile="false"
    03.                       Width="260px"
    04.                       Height="350px"
    05.                       AllowPaging="true"
    06.                       PageSize="10"
    07.                       OnClientItemSelected="OnClientItemSelected">
    08.            <Configuration EnableAsyncUpload="true" AllowMultipleSelection="true">
    09.            </Configuration>
    10. </telerik:RadFileExplorer>

    Updated Configuration for RadFileExplorer codebehind .aspx :

    01.Public Sub Configure()
    02. 
    03.    RadFileExplorer1.EnableOpenFile = False
    04. 
    05.    RadFileExplorer1.DisplayUpFolderItem = True
    06. 
    07.    RadFileExplorer1.AllowPaging = False
    08. 
    09.    RadFileExplorer1.EnableCreateNewFolder = False
    10. 
    11.    RadFileExplorer1.Upload.Enabled = True
    12. 
    13.    ' Set the RadFileExplorer's maximum file size property
    14.    RadFileExplorer1.AsyncUpload.MaxFileSize = System.Configuration.ConfigurationManager.AppSettings("maxFileSize")
    15. 
    16.    ' Set postbacktrigger to the ID of the control that executes file upload processing
    17.    'RadFileExplorer1.AsyncUpload.PostbackTriggers = New String() {"Execute"}
    18. 
    19.    RadFileExplorer1.TreePaneWidth = 100
    20. 
    21.    Dim physicalPathToFile As String = ""
    22.    Dim virtualPathToFile As String = ""
    23. 
    24.    For Each mappedPath As KeyValuePair(Of String, String) In MappedPaths
    25. 
    26.        If mappedPath.Key.Contains("Share") Then
    27.            ' Build the physical path to the file ;
    28.            physicalPathToFile = mappedPath.Value
    29.            virtualPathToFile = mappedPath.Key
    30. 
    31.            ' Break the foreach loop ;
    32.            Exit For
    33.        End If
    34.    Next
    35. 
    36.    Dim initialpath As String = ""
    37.    initialpath = virtualPathToFile
    38. 
    39.    '  load the paths - physical, virtual - ex."C:\PhysicalSource\ROOT", "\\server.name\Path\SharedDir"
    40.    ' the path where the files reside on the server/share
    41.    Dim viewPaths As String()
    42.    viewPaths = New String() {physicalPathToFile, virtualPathToFile}
    43. 
    44.    '  load the upload path, clientPath, where the user's file will be uploaded to, local fileystem on the client
    45.    '  Replace the \ with / since the File Explorer requires virtual paths
    46.    'Dim uploadPaths As String() = New String() {clientPath.Replace("\", "/")}
    47. 
    48.    ' Testing using Path without replacing the slashes in the path value
    49.    Dim uploadPaths As String() = New String() {clientPath}
    50. 
    51.    ' set deletepath property for the upload button to work
    52.    'Dim deletePaths As String() = New String() {clientPath.Replace("\", "/")}
    53. 
    54.    Dim deletePaths As String() = New String() {clientPath}
    55. 
    56.    RadFileExplorer1.Configuration.ViewPaths = viewPaths
    57.    RadFileExplorer1.Configuration.UploadPaths = uploadPaths
    58. 
    59.    RadFileExplorer1.Configuration.SearchPatterns = New String() {"*.*"}
    60. 
    61.    RadFileExplorer1.Configuration.ContentProviderTypeName = GetType(CustomFileSystemProvider).AssemblyQualifiedName
    62. 
    63.    RadFileExplorer1.InitialPath = initialpath
    64.    '    End If
    65.    'End If
    66. 
    67.End Sub

    Also, I have a custom ashx handler that validates file according to business data logic received from the client interface.  In your example the CustomFileSystemProvider.vb file uses a StoreFile method that needs to be overrided for my custom implementation.  I noticed that the file's type is received as Telerik.Web.UI.UploadedFile.  Is this the only way to receive the uploaded files?  How does the handler file receive the uploaded file from the provider?  Or, does processing occur in one or the other?  I need the capture the uploaded file in my custom ashx file for processing as HttpContext.  Is the StoreFile method optional or required?  Please clarify.  Thanks.

    01.Public Overrides Function StoreFile(ByVal file As Telerik.Web.UI.UploadedFile, ByVal path As String, ByVal name As String, ByVal ParamArray arguments As String()) As String
    02. 
    03.    '  Testing method on how to get HttpContext from FileExplorer and send to Upload.ashx script for processing
    04.    'Dim upload As New Upload
    05. 
    06.    'upload.ProcessRequest(file)
    07.    Dim virtualPathToFile As String = Context.Server.HtmlDecode(Context.Request.QueryString("path"))
    08. 
    09.    Dim physicalPath As String = Me.GetPhysicalFromVirtualPath(path)
    10.    If physicalPath Is Nothing Then
    11.        Return String.Empty
    12.    End If
    13. 
    14.    physicalPath = PathHelper.AddEndingSlash(physicalPath, "\"c) & name
    15.    file.SaveAs(physicalPath)
    16. 
    17.    ' Returns the path to the newly created file
    18.    Return PathHelper.AddEndingSlash(path, "/"c) & name
    19.End Function

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Vessy
    Admin
    Vessy avatar
    1380 posts

    Posted 17 Mar 2014 Link to this post

    Hello Jermaine,

    The StoreFile() is an abstract class that must be overriden when creating a custom FileBrowserContentProvider, and so it must receive an UploadedFile item as a first argument. The UploadedFile contains standard information regarding the uploaded FileItem, including the stream of the currently uploaded file.

    On a side note, the handler provided by us in the linked by you KB article is used only for accessing the file data when opening it. This means that the handler does not interacts with the content provider neither vice versa. You will need to make a custom request in order to pass some uploaded file related information to a generic handler and to validate it after that with a custom logic.

    I would like to kindly remind you that FileExplorer is not designed to work with files from the client system. This is why such an implementation may lead to unexpected behavior and so is not supported.

    Regards,
    Vessy
    Telerik
     

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

     
  5. Jermaine
    Jermaine avatar
    13 posts
    Member since:
    Feb 2013

    Posted 17 Mar 2014 Link to this post

    Thanks for the explaining.  From what you have suggested, I need to override the Storefile() method and pass the UploadFile property to my custom file content provider for processing.  The issue I am having is with initiating the upload.  The upload button is disabled.
  6. Vessy
    Admin
    Vessy avatar
    1380 posts

    Posted 20 Mar 2014 Link to this post

    Hi Jermaine,

    The upload button is set as enabled/disabled depending on the current folder's permissions. In the folder's path is amont the configured Upload paths (or is a child to any of these folders) the Upload button will be enabled. Please, note, that if the whole application does not have enough permissions to view/write a specfic folder, FileExplorer also will not be able to manipulate the items.

    I would suggest you to check this troubleshooting article and modify the tests in it in order to check the permissions of the listed by you folders. 

    Kind regards,
    Vessy
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
  7. Jermaine
    Jermaine avatar
    13 posts
    Member since:
    Feb 2013

    Posted 24 Mar 2014 Link to this post

    I discovered the problem was caused from not defining the same path for view, upload, and the initial path properties.  I uncommented the path assignment statements and assigned the same path value to each property to resolve this issue.  Initially, the test was successful even though I ran the FullPermissionTest function in the Page_Load without assigning the permissions so I was stumped.  But on a hunch, I assigned the properties and the Upload button was enabled. 

    Now that I can Upload, I see that the RadAsyncUpload is being used.  I would like to manually upload files selected from my queue that is populated with files selected from client click events in the explorer since my project requires an alternative upload process.  Is there  a means for opting out of using the RadAsyncUpload and grabbing the httpContext.RequestFiles( "filedata") for uploading at my behest?  Thanks.
  8. Vessy
    Admin
    Vessy avatar
    1380 posts

    Posted 27 Mar 2014 Link to this post

    Hi Jermaine,

    By design RadFIleEplorer provides two options for file uploading - using RadUpload and using RadAsyncUpload. Switching between both controls can be done by configuring the RadFileExplorer's Configuration-EnableAsyncUpload property:
    <telerik:RadFileExplorer ID="RadFileExplorer1" runat="server">
        <Configuration ViewPaths="~/" DeletePaths="~/" UploadPaths="~/" EnableAsyncUpload="false" />
    </telerik:RadFileExplorer>

    In non of these upload options fits your scenario, you can implement a custom command in the way described in this help article, adding the desired custom upload logic to it.

    Kind regards,
    Vessy
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017