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

Rad upload is not working in Rad Window

5 Answers 125 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Prassin
Top achievements
Rank 1
Prassin asked on 17 Jul 2012, 07:31 AM
Hi All,

Rad upload is not working on my Rad window.. please have look below code and fix the error.

Aspx:
<telerik:RadWindow runat="server" ID="RadWindow_ContentTemplate" RestrictionZoneID="ContentTemplateZone"
         Modal="true" Skin="Office2010Blue" Height="350px" Width="478px">
         <ContentTemplate>
             <p class="contText">
                 Hi, Pleae upload photo here and click complete button..
             </p>
             <div class="contButton">
                 Upload photo :
                 <telerik:RadUpload ID="imgUpload" runat="server" ToolTip="File Size limit 500KB, (jpg, bmp, png, gif)"
                     ControlObjectsVisibility="None" Width="178px" TargetFolder="~/Upload/" OnClientFileSelected="OnClientFileSelectedHandler">
                 </telerik:RadUpload>
             </div>
             <div class="contButton">
                 <asp:Image ID="imgLogo" runat="server" Visible="true" AutoAdjustImageControlSize="false"
                     Height="123px" Width="130px"></asp:Image></div>
             <div class="contButton">
                 <telerik:RadButton ID="RadButtonUpload" runat="server" Text="Complete" Width="200px">
                     <Icon SecondaryIconCssClass="rbOpen" SecondaryIconRight="4" SecondaryIconTop="4" />
                 </telerik:RadButton>
             </div>
             <div class="contButton">
                 <telerik:RadTextBox ID="RadButton1" runat="server" Text="Upload" Width="200px" Visible="False">
                 </telerik:RadTextBox>
             </div>
         </ContentTemplate>
     </telerik:RadWindow>

Script:
<script type="text/jscript">
           function OnClientFileSelectedHandler(sender, eventArgs) {
               var img = document.getElementById("<%= imgLogo.ClientID %>");
               img.src = eventArgs.get_fileInputField().value;
           }
       </script>

please clarify the error.

Regards,

Prassin

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Jul 2012, 09:20 AM
Hello,

I was able to make the RadUpload working by changing the  script type as text/javascript.
JS:
<script type="text/javascript">
     function OnClientFileSelected(sender, eventArgs)
     {
         var img = document.getElementById("<%= imgLogo.ClientID %>");
        img.src = eventArgs.get_fileInputField().value;
     }
</script>
Hope this helps.

Thanks,
Shinu.
0
Prassin
Top achievements
Rank 1
answered on 18 Jul 2012, 04:58 AM
Hi Shinu,

Thanks for your replay..
I have changed the script like your script...
<script type="text/javascript">
           function OnClientFileSelectedHandler(sender, eventArgs) {
               var img = document.getElementById("<%= imgLogo.ClientID %>");
               img.src = eventArgs.get_fileInputField().value;
           }
       </script>

but still i cant fill the image here....

Please confirm me the error of this script..

Regards,

Prassin
0
Shinu
Top achievements
Rank 2
answered on 18 Jul 2012, 09:06 AM
Hello,

The following code will work correctly on IE browser only, since in Firefox the input.value returns the filename instead of the full path to the file.

For security reasons the above code will work only on localhost, to make it work remotely you need to add the site to the Trusted Sites.Check the following help documentation which explains the same.
How to Preview Image Before Upload (IE only)

Thanks,
Shinu.

0
Prassin
Top achievements
Rank 1
answered on 18 Jul 2012, 10:57 AM
HI Shinu,

Thanks for your replay..

if it is not compatible for all browsers then is there any way to show that Rad upload and asp image  inside the rad grid fromtemplate..
my requirement is  when i select the file path that time the respective image need to be shown..
my rad grid having add,edit,delete functionality.. is there any solution with this then please share with me..

Regards,

Prassin 
0
Plamen
Telerik team
answered on 18 Jul 2012, 03:32 PM
Hello Prassin,

 
When using RadUpload such behavior is highly restricted for security reasons as it is explained in the article that was linked by Shinu so you can consider using RadAsyncUpload as it is shown in this on-line demo.

Hope this will be helpful.

Kind regards,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Upload (Obsolete)
Asked by
Prassin
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Prassin
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or