This is a migrated thread and some comments may be shown as answers.

Having issue with supported files.

7 Answers 65 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Darshan Sedani
Top achievements
Rank 1
Darshan Sedani asked on 27 Jun 2014, 09:27 AM
Hello Support Team,

I am using rad async upload control in my project.

I have kept filtration for the images. If i am trying to browse file that filter is not working at first time.

Attached snap and zip file for the code.


 <script type="text/javascript">
        function validationFailed(radAsyncUpload, args) {
            var erorMessage = getErrorMessage(radAsyncUpload, args);
            if (erorMessage == false) {
                alert("The file must have the extension gif,jpeg,jpg,png");
                return false;
            }
            return true;
        }

        function uploadFile(radUpload, arguments) {
            $('#<%=btnUploadImage.ClientID %>').click();
        }
    </script>
    <div>
        <div id="divUploadControl" style="float: left; width: 100%;">
            <telerik:RadAsyncUpload runat="server" ID="radUploadImage" EnableFileInputSkinning="true"
                MultipleFileSelection="Disabled" MaxFileInputsCount="1" OnClientFileUploaded="uploadFile"
                PostbackTriggers="btnUploadImage" Width="250" Localization-Select="Browse" OnClientValidationFailed="validationFailed"
                EnableInlineProgress="false" TabIndex="3" AllowedFileExtensions="gif,jpeg,jpg,png">
                <FileFilters>
                    <telerik:FileFilter Description="Allowed files are gif,jpeg,jpg,png" Extensions="gif,jpeg,jpg,png" />
                </FileFilters>
            </telerik:RadAsyncUpload>
            <telerik:RadProgressManager ID="RadProgressManager1" runat="server" />
            <telerik:RadProgressArea ID="RadProgressArea1" Width="240px" runat="server" BackColor="Black"
                Skin="WebBlue" ToolTip="Uploading">
            </telerik:RadProgressArea>
        </div>
        <input type="button" id="btnUploadImage" runat="server" style="width: 0px; font-size: 0px;
            height: 0px;" value="" onserverclick="btnUploadImage_Click" />
    </div>




7 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Jun 2014, 10:30 AM
Hi Darshan Sedani,

RadAsyncUpload uses Upload Modules for different browsers. Filtering will not support in FileApi module. This is because browsers don’t provide native file filtering support.  For that you have to disable the Upload Modules  as follows.

JavaScript:
Telerik.Web.UI.RadAsyncUpload.Modules.FileApi.isAvailable = function () { return false; };

Thanks,
Shinu.
0
Darshan Sedani
Top achievements
Rank 1
answered on 30 Jun 2014, 08:41 AM
Thanks Shinu,

But where to keep these lines? 

Inside script tag anywhere?

e.g

<script type="text/javascript">
            Telerik.Web.UI.RadAsyncUpload.Modules.FileApi.isAvailable = function () { return false; };
 </script>
0
Shinu
Top achievements
Rank 2
answered on 30 Jun 2014, 10:00 AM
Hi Darshan Sedani,

Yes, you have to mention that in JavaScript. Please try the below sample code snippet which works fine at my end.

ASPX:
<telerik:RadAsyncUpload ID="radasynupldImageFiles" runat="server" MultipleFileSelection="Automatic">
    <FileFilters>
        <telerik:FileFilter Description="Documents(jpg;png)" Extensions="jpg,png" />
    </FileFilters>
</telerik:RadAsyncUpload>

JavaScript:
<script type="text/javascript">
    Telerik.Web.UI.RadAsyncUpload.Modules.FileApi.isAvailable = function () { return false; };
    Telerik.Web.UI.RadAsyncUpload.Modules.IFrame.isAvailable = function () { return false; };
</script>

Thanks,
Shinu.
0
Mayur
Top achievements
Rank 1
answered on 02 Jul 2014, 09:57 AM
Hi,

This script is working fine but for first time its not showing filter bar whereas i have put this script at client side pageload.I have attached png file .Plz  have a look.

<script type="text/javascript">
    Telerik.Web.UI.RadAsyncUpload.Modules.FileApi.isAvailable = function () { return false; };
    Telerik.Web.UI.RadAsyncUpload.Modules.IFrame.isAvailable = function () { return false; };
</script>


0
Darshan Sedani
Top achievements
Rank 1
answered on 16 Sep 2014, 09:20 AM
Hi Shinu,

I tried the same thing mentioned above in your reply. But its is not working properly. You can have a look in the video file attached.

Please suggest another way or solution if you have one.

Thanks.
0
Darshan Sedani
Top achievements
Rank 1
answered on 16 Sep 2014, 09:22 AM
Hi Shinu,

Can't upload video file. Attaching snapshot for your reference.

Thanks
0
Peter Filipov
Telerik team
answered on 18 Sep 2014, 10:02 AM
Hello Darshan,

The filter is applied only when Silverlight or Flash module is used which is possible only under IE9,8,7 versions.

Regards,
Peter Filipov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
AsyncUpload
Asked by
Darshan Sedani
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Darshan Sedani
Top achievements
Rank 1
Mayur
Top achievements
Rank 1
Peter Filipov
Telerik team
Share this question
or