Files Removing issue

1 posts, 0 answers
  1. SREERAM
    SREERAM avatar
    2 posts
    Member since:
    Mar 2017

    Posted 21 Mar 2017 Link to this post

    I want to remove the files based on the extensions in entire application.by getting the input type 'file' .for the first time means,if we select either one or multiple files it is fine.after we add some more/ one file to the uploader. then it was not working. means that was not firing for next selection .i tried with basic file selection of html that was working fine.You can see the code that i'm trying .

     

    =============================================

    <script src="Scripts/jquery-1.9.1.js" type="text/javascript"></script>
        <telerik:RadScriptBlock ID="radSript1" runat="server">
            <script type="text/javascript">
                $(window).load(function () {
                    $("input[type=file]").change(function () {
                        var names = [];
                        debugger;
                        for (var i = 0; i < $(this).get(0).files.length; ++i) {
                            names.push($(this).get(0).files[i].name);
                        }
                        $("input[type=text]").val(names);
                    });
                });  
                   
            </script>
        </telerik:RadScriptBlock>

    ===============================

    $('input[type="file"]').change(function () {
                        var indexes = [];
                        var controlid = this.id;
                        var rename = controlid.replace('file0', '');
                        var upload1 = $find(rename);
                        var count = upload1._selectedFilesCount
                        for (var a = 0; a < count - 1; a++) {
                            var fileName = e.target.files[a].name;
                            var fileextension = '.' + fileName.split('.').pop().toUpperCase();
                            if (fileextension == ".EXE" || fileextension == ".BAT" || fileextension == ".JS") {
                                alert("Please Select Valid Formats...");
                                upload1.deleteFileInputAt(a);
                                var cnd = $find(rename);
                                count--;
                                a = -1;
                            }
                        }
                    });

    ==============================================

    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <div>
            <telerik:RadAsyncUpload RenderMode="Lightweight" runat="server" MultipleFileSelection="Automatic"
                ID="rduploadfile" />
            <telerik:RadAsyncUpload RenderMode="Lightweight" runat="server" MultipleFileSelection="Automatic"
                ID="RadAsyncUpload1" />
            
        <input type="file" id="fl1" name="file1" multiple="multiple" />
        <input type="file" id="fl2" name="file" multiple="multiple" />
        <input name="file" type="text" />
        </div>

    ======================================

Back to Top