Error Message on file extension

Thread is closed for posting
2 posts, 0 answers
  1. Web Services
    Web Services avatar
    243 posts
    Member since:
    Apr 2008

    Posted 22 Nov 2011 Link to this post

    I have an uploader with accepted file types set. Is there a way to display an error message? Right now, it just doesn't upload the file but no message is displayed?

    <telerik:RadUpload ID="attachedFile" runat="server" MaxFileInputsCount="1" ControlObjectsVisibility="None"
                    Width="300" TargetFolder="~/UploadedGrantResponse" OverwriteExistingFiles="true" AllowedFileExtensions=".doc,.docx,.pdf">

    If (attachedFile.UploadedFiles.Count > 0) Then
        For Each postedFile As UploadedFile In attachedFile.UploadedFiles
            If Not [Object].Equals(postedFile, Nothing) Then
                targetFileName = Path.Combine(targetFolder, postedFile.GetNameWithoutExtension() & " " & time & postedFile.GetExtension())
                fileName = postedFile.GetNameWithoutExtension() & "%20" & time & postedFile.GetExtension()
                fileName = fileName.replace(" ", "%20")
                deleteFile = postedFile.GetName()
            End If 'if not object
        Next 'for each uploaded file
    End If 'if attachedFile.UploadedFiles.Count
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 23 Nov 2011 Link to this post


    You can try the following.
    <telerik:RadUpload ID="RadUpload1" runat="server" InitialFileInputsCount="1" AllowedFileExtensions=".zip,.jpg,.jpeg" />
    <asp:Button ID="buttonSubmit" runat="server" Text="Submit" Style="margin-top: 6px" />
    <asp:CustomValidator ID="Customvalidator1" runat="server" Display="Dynamic" ClientValidationFunction="validateRadUpload1">
    <script type="text/javascript">
       function validateRadUpload1(source, arguments)
        arguments.IsValid = $find('<%= RadUpload1.ClientID %>').validateExtensions();
        alert("Invalid Extension");

Back to Top