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

AsynchUpload in div with display none and AllowedFileExtensions

6 Answers 177 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Yeroon
Top achievements
Rank 2
Yeroon asked on 24 Mar 2011, 11:36 AM
Hello,

I have a RadAsynchUpload control inside a div with style display:none.

When the user clicks a certain radio I switch the div to display:block. In this scenario the AllowedFileExtensions is ignored. If I put the upload control in a div with normal display it works.

Here is my code to reproduce the problem:

Javascript that handle showing div:

<telerik:RadScriptBlock ID="rsb" runat="server">
        <script type="text/javascript">
            function toggleDiv(div, st) {
                $get('div' + div).style.display = st;
            }
            function validationFailed(sender, eventArgs) {
                $(".ErrorHolder").append("<p><span style='color:red;'>Het bestand '" + eventArgs.get_fileName() + "' is te groot.<br />De maximale bestandsgrootte is 100Mb per bestand. Upload afgebroken.</span></p>").fadeIn("slow");
            }
            function filesSelected(sender, eventArgs) {
                
            }
             
        </script>
    </telerik:RadScriptBlock>

aspx and html for upload that doesnt show the fileextensions in the open dialog:

<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
     
    <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="RadioButtons, Textbox, Checkboxes, Buttons"
        EnableRoundedCorners="false" Skin="Office2007" />
 
<asp:RadioButton ID="rb0post" runat="server" GroupName="g0" Text="per post" TextAlign="Right"
                                        onclick="toggleDiv('0', 'none');" />
                                    <br />
                                    <asp:RadioButton ID="rb0email" runat="server" GroupName="g0" Text="digitaal" TextAlign="Right"
                                        onclick="toggleDiv('0', '');" />
                                    <br />
                                    <div id="div0">
                                        <telerik:RadAsyncUpload OnClientFilesSelected="filesSelected" MaxFileSize="102400000" ID="RadAsyncUpload0" runat="server" Skin="Office2007" TargetFolder="~/Uploads"
                                            AllowedFileExtensions=".doc,.xls,.ppt,.pdf,.jpg,.gif,.bmp,.tif,.tiff,.png,.sif,.zip,.swf,.docx,.xlsx,.pptx,.avi,.mpg,.mpeg,.mp3,.wav,.odt,.ods"
                                            Culture="Dutch (Netherlands)" MultipleFileSelection="Automatic" OnClientValidationFailed="validationFailed">
                                            <Localization Cancel="Annuleren" Remove="Verwijderen" Select="Selecteren" />
                                        </telerik:RadAsyncUpload><div id="ErrorHolder"></div>
                                        Reeds geüpload:
                                    </div>


If I place an upload not in a div with display none it does work:

<telerik:RadAsyncUpload OnClientFilesSelected="filesSelected" MaxFileSize="102400000" ID="RadAsyncUpload1" runat="server" Skin="Office2007" TargetFolder="~/Uploads"
                                            AllowedFileExtensions=".doc,.xls,.ppt,.pdf,.jpg,.gif,.bmp,.tif,.tiff,.png,.sif,.zip,.swf,.docx,.xlsx,.pptx,.avi,.mpg,.mpeg,.mp3,.wav,.odt,.ods"
                                            Culture="Dutch (Netherlands)" MultipleFileSelection="Automatic" OnClientValidationFailed="validationFailed">
                                            <Localization Cancel="Annuleren" Remove="Verwijderen" Select="Selecteren" />
                                        </telerik:RadAsyncUpload><div id="ErrorHolder">


Any suggestions?

6 Answers, 1 is accepted

Sort by
0
Yeroon
Top achievements
Rank 2
answered on 24 Mar 2011, 11:49 AM
PS using 2011,1,315,35
0
Accepted
Peter Filipov
Telerik team
answered on 29 Mar 2011, 03:55 PM
Hello Yeroon,

I have reproduced your scenario and I have got the same result. A workaround for the issue:
$get('div name').style.visibility = 'hidden';

Kind regards,
Peter Filipov
the Telerik team
0
Stein
Top achievements
Rank 1
answered on 16 Jun 2011, 03:27 PM
I am using 2011.1.519.40 and seems like this still is a problem?

The source of the page includes the correct allowedFileExtensions, but it still shows .pdf + .doc that I've entered manually designtime.
Sys.Application.add_init(
 
function() {
  
$create(Telerik.Web.UI.RadAsyncUpload, {
 
"_enabled":true,"_fileFilter":"{\"values\":[{\"Description\":\"*.pdf; *.doc\",\"Extensions\":\"*.pdf;*.doc\"}]}","_flashModuleUrl":"/WebResource.axd?d=jrVgkxnQlgqKib-TpoASN821the8kMa45wI6olJc-1xWRkMUO1PUWAXCPpgROe8XGOG51-IpogIcNHAlXH3gD2Ls9bp-G72Ech7fHhZrI0diyqBoE7f9LGvg45sBi-uM3IJ0RlPoLhz9sISfpKNSSU9Zcf11gzKrbl4Hay9BExkTJukHvW1BApv751GYjDjU0&t=634419343086451041","_handlerUrl":"/uploadHandler.ashx?type=rau","_multipleFileSelection":1,"_pageGUID":"c3957e5a-b547-437e-9345-cb58d3982d0d","_progressHandlerUrl":"Telerik.RadUploadProgressHandler.ashx","_serializedConfiguration":"/wEF7QN7IlRhcmdldEZvbGRlciI6Ii93RmxCYUVXV2VEYjROeHVMU0tNT0M1SjFyWVFKSTAxOEtqRFZFc3IydGtuWTRzPSIsIlRlbXBUYXJnZXRGb2xkZXIiOiIvd0VGWDBZNlhGVnpaWEp6WEZOMFpXbHVYRVJ2WTNWdFpXNTBjMXhXYVhOMVlXd2dVM1IxWkdsdklESXdNVEJjVUhKdmFtVmpkSE5jU1cxd2JHVnZWMlZpWEVsdGNHeGxiMWRsWWx4QmNIQmZSR0YwWVZ4U1lXUlZjR3h2WVdSVVpXMXc4RGhWQkZjKzczc2lDVS9QVGcveVh2RHQ2S0pIWDQwMmFaelFyYXB5QVZnPSIsIk1heEZpbGVTaXplIjowLCJUaW1lVG9MaXZlIjp7IlRpY2tzIjoxNDQwMDAwMDAwMDAsIkRheXMiOjAsIkhvdXJzIjo0LCJNaWxsaXNlY29uZHMiOjAsIk1pbnV0ZXMiOjAsIlNlY29uZHMiOjAsIlRvdGFsRGF5cyI6MC4xNjY2NjY2NjY2NjY2NjY2NiwiVG90YWxIb3VycyI6NCwiVG90YWxNaWxsaXNlY29uZHMiOjE0NDAwMDAwLCJUb3RhbE1pbnV0ZXMiOjI0MCwiVG90YWxTZWNvbmRzIjoxNDQwMH196YTTQDQ5ifOc/HsgF/Fe31iCDZ5o8r/OaafLvOofIDo=","_serializedConfigurationType":"/wEFgAFUZWxlcmlrLldlYi5VSS5Bc3luY1VwbG9hZENvbmZpZ3VyYXRpb24sIFRlbGVyaWsuV2ViLlVJLCBWZXJzaW9uPTIwMTEuMS41MTkuNDAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49MTIxZmFlNzgxNjViYTNkNFSBeXd9AYVfQbXd0Qfkd8APsY8GbsUl2ZOD8Roc13vd","_silverlightModuleUrl":"/WebResource.axd?d=8fSGu_akfeTVelDbjdFx-9aT-PrcerSlz_zMZYDv93a2OWC_6aPTb3WJwNoZHIOAewbiaNCHUB9OwFbNXW_WMAl7eGwt4k-qd2DeJH06ZEkceuikhQIRfkfZeM2oM_YUZC8nd-5e9r5OmRPCT22kmE9c9F3sB8wXzyBw7oZ9uAWzaWCkr0-HRs0_lVgbegzwi16MyBX7izliG-w0piklRw2&t=634419343086451041","_skin":"Default","allowedFileExtensions":"[\".pdf\",\".doc\",\".docx\",\".rtf\"]","clientStateFieldID":"ctl00_mContent_RadAsyncUpload_CustomInput_ClientState","localization":{"Select":"Velg fil","Remove":"Ta vekk","Cancel":"Cancel"},"maxFileCount":10}, {"filesUploaded":customFileUploaded,"validationFailed":validationFailed}, null, $get("ctl00_mContent_RadAsyncUpload_CustomInput"));
  
});
0
Peter Filipov
Telerik team
answered on 20 Jun 2011, 01:22 PM
Hello Stein,

We are aware of that issue. The problem is caused by the Mircrosoft Silverlight.

Please use the approach below to disable the Silverlight module and use the Flash module to upload files.
Here is a sample code how to disable the Silverlight:

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

Regards,
Peter Filipov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Stein
Top achievements
Rank 1
answered on 20 Jun 2011, 01:27 PM
I've already disabled the Flash-module because it was a pain to get to work on Mac and with different browsers.
If we also were to disable Silverlight as well, well..... what do we have left???

And are you saying it's a permanent problem with Silverlight thats out of your hands or are you working on a fix on it?
0
Peter Filipov
Telerik team
answered on 23 Jun 2011, 11:34 AM
Hi Stein,

Thank you for contacting us.

When Siliverlight and Flash modules are disabled, the IFrame module left.
Regarding the issue with Silverlight it is out of our hands.

I will be glad to assist you further.

Best wishes,
Peter Filipov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
AsyncUpload
Asked by
Yeroon
Top achievements
Rank 2
Answers by
Yeroon
Top achievements
Rank 2
Peter Filipov
Telerik team
Stein
Top achievements
Rank 1
Share this question
or