Upload issues once site published

4 posts, 0 answers
  1. Cliff Gibson
    Cliff Gibson avatar
    45 posts
    Member since:
    Oct 2009

    Posted 18 Nov 2010 Link to this post

    I've got a site which is using the RadRotator and AsyncUpload controls for a photo album.

    During development and debugging it all works fine (Win 7) but once published to the server the images do not always display and I cannot upload files - no error is given though.

    Using the latest build of the controls, the temp upload directory was created first time in and files are appearing in there. I've attached the screen shots from the debug/dev box site, the published site and the uploads part from the published site.


    <%@ Page Language="C#" MasterPageFile="~/MasterPageDialogs.master" AutoEventWireup="true" CodeFile="Photos.aspx.cs" Inherits="Dialogs_Photos" %>
      
    <%@ MasterType VirtualPath="~/MasterPageDialogs.master" %>
      
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
      
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentHead" Runat="Server">
        <link href="../Rotator.css" rel="stylesheet" type="text/css" />
    </asp:Content>
      
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentBody" Runat="Server">
        <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"></telerik:RadAjaxManagerProxy>
          
        <script type="text/javascript">
            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz az well)
                return oWindow;
            }
      
            function CloseOnReload() {
                GetRadWindow().VisibleOnPageLoad = false;
                GetRadWindow().close();
            }
      
            function RefreshParentPage() {
                GetRadWindow().BrowserWindow.location.href = GetRadWindow().BrowserWindow.location.href;
            }
        </script>  
      
          
        <telerik:RadAjaxManagerProxy ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="thumbRotator">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="imgPhoto" />
                        <telerik:AjaxUpdatedControl ControlID="detailsPanel" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="ibtnSavePhoto">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="ibtnSavePhoto" />
                        <telerik:AjaxUpdatedControl ControlID="thumbRotator" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="ibtnDeletePhoto">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="ibtnDeletePhoto" />
                        <telerik:AjaxUpdatedControl ControlID="thumbRotator" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManagerProxy>
      
        <asp:Label ID="lblPhotoType" runat="server" Text="" style="display:none"></asp:Label>
        <asp:Label ID="lblPhotoKey" runat="server" Text="" style="display:none"></asp:Label>
        <asp:Label ID="lblPhotoSubKey" runat="server" Text="" style="display:none"></asp:Label>
          
        <table width="743" cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td style="height: 22px">
                    <img src="../Images/Rotator/white.gif" height="22" width="60" alt="" style="float: left;" /></td>
                <td style="height: 22px">
                    <img src="../Images/Rotator/cornerLeftTop.gif" height="22" width="50" alt="" style="float: left;" /></td>
                <td style="height: 22px">
                    <img src="../Images/Rotator/topLeft.gif" height="22" width="292" alt="" style="float: left;" /></td>
                <td style="height: 22px">
                    <img src="../Images/Rotator/topRight.gif" height="22" width="280" alt="" style="float: left;" /></td>
                <td style="height: 22px">
                    <img src="../Images/Rotator/cornerRightTop.gif" height="22" width="62" alt="" style="float: left;" /></td>
            </tr>
            <tr>
                <td>
                    <img src="../Images/Rotator/whiteMiddle.gif" height="243" width="60" alt="" style="float: left;" /></td>
                <td>
                    <img src="../Images/Rotator/leftFrame.gif" height="243" width="50" alt="" style="float: left;" /></td>
                <td class="previewPane">
                    <div style="margin-top: 20px">
                        <telerik:RadBinaryImage ID="imgPhoto" runat="server" Height="192" Width="192" ResizeMode="Fit"  ImageAlign="Middle" />
      
                    </div>
                </td>
                <td class="infoPane">
                    <div class="infoPaneBg" runat="server" id="detailsPanel">
                        <div class="imageDetailsHeader">
                            <table width="100%">
                                <tr>
                                    <td width="70%">
                                        Image details:
                                    </td>
                                    <td width="15%" align="center">
                                        <asp:ImageButton ID="ibtnSavePhoto" runat="server" 
                                            ImageUrl="~/Images/Save.png" onclick="ibtnSavePhoto_Click" />
                                    </td>
                                    <td width="15%" align="center">
                                        <asp:ImageButton ID="ibtnDeletePhoto" runat="server" 
                                            ImageUrl="~/Images/Delete.png" onclick="ibtnDeletePhoto_Click" />
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <div id="viewPanel">
                            <div class="details">
                                <strong>Title:</strong>
                                <asp:Label ID="lblPhotoID" runat="server" Text="" style="display:none"></asp:Label>
                                <asp:TextBox ID="txtPhotoTitle" runat="server" Text=""></asp:TextBox>
                            </div>
                            <div class="details">
                                <strong>Description:</strong>
                                <asp:TextBox ID="txtPhotoDescription" runat="server" Text=""></asp:TextBox>
                            </div>    
                            <div class="details">
                                  
                            </div>    
                            <div class="details" style="margin-top: 5px; margin-left: 28px">
                                      
                            </div>
                        </div>
                    </div>
                </td>
                <td>
                    <img src="../Images/Rotator/rightFrame.gif" height="243" width="62" alt="" style="float: left;" /></td>
            </tr>
            <tr>
                <td>
                    <img src="../Images/Rotator/whiteShadow.gif" height="117" width="60" alt="" /></td>
                <td>
                    <img src="../Images/Rotator/left.gif" id="img_left" height="117" width="50" alt="" style="cursor: pointer" /></td>
                <td colspan="2" class="thumbsViewer">
                    <telerik:RadRotator ID="thumbRotator" runat="server" RotatorType="ButtonsOver" Width="572"
                        Height="118px" ItemHeight="118" ItemWidth="145" FrameDuration="1" ScrollDirection="Left,Right" 
                        DataSourceID="dsThumbnails" OnItemClick="ShowImage">
                        <ItemTemplate>
                            <div class="itemTemplate">
                                <asp:Label runat="server" ID="lblPhotoID" Text='<%# Eval("PhotoID") %>' style="display:none"></asp:Label>
                                <asp:Label runat="server" ID="lblTitle" Text='<%# Eval("Title") %>' style="display:none"></asp:Label>
                                <asp:Label runat="server" ID="lblDescription" Text='<%# Eval("Description") %>' style="display:none"></asp:Label>
                                <telerik:RadBinaryImage ID="imgHiddenPhoto" runat="server" DataValue='<%# Eval("PhotoFile") %>'  style="display:none"/>
                                <telerik:RadBinaryImage ID="imgThumbnail" runat="server" 
                                    DataValue='<%# Eval("Thumbnail") %>' Height="118px" Width="118px" ResizeMode="Fit" 
                                    CssClass="RotatorImage" AlternateText='<%# Eval("Title") %>' ToolTip='<%# Eval("Title") %>' />
                            </div>
                        </ItemTemplate>
                        <ControlButtons LeftButtonID="img_left" RightButtonID="img_right" />
                    </telerik:RadRotator>
                </td>
                <td>
                    <img src="../Images/Rotator/right.gif" id="img_right" height="117" width="62" alt="" style="cursor: pointer" /></td>
            </tr>
        </table>
      
              
        <asp:SqlDataSource ID="dsThumbnails" runat="server" 
            ConnectionString="<%$ ConnectionStrings:EventMgmtCSDev %>" 
              
            SelectCommand="SELECT [PhotoID], [Thumbnail], [PhotoFile], [Title], [Description] FROM [Photos] WHERE (([PhotoKey] = @PhotoKey) AND ([PhotoType] = @PhotoType) AND ([PhotoSubKey] = @PhotoSubKey))">
            <SelectParameters>
                <asp:ControlParameter ControlID="lblPhotoKey" Name="PhotoKey" 
                    PropertyName="Text" Type="Int64" />
                <asp:ControlParameter ControlID="lblPhotoType" Name="PhotoType" 
                    PropertyName="Text" Type="String" />
                <asp:ControlParameter ControlID="lblPhotoSubKey" Name="PhotoSubKey" 
                    PropertyName="Text" Type="Int64" />
            </SelectParameters>
        </asp:SqlDataSource>
          
        <br />
          
        <asp:Button ID="btnUploadPhotos" runat="server" Text="Upload Photos"/>
      
      
        <telerik:RadToolTip ID="ToolTipAddQuote" runat="server" Width="300px" Height="300px" 
            TargetControlID="btnUploadPhotos" Position="Center" RelativeTo="BrowserWindow"
            HideEvent="ManualClose" ShowEvent="OnClick" Animation="Slide" AnimationDuration="1000">
              
            <telerik:RadProgressManager runat="server" ID="RadProgressManager1" />
              
            <table width="90%">
                <tr>
                    <td>
                        <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1"
                            MultipleFileSelection="Automatic" TemporaryFileExpiration="0:15:00">
                        </telerik:RadAsyncUpload>
                    </td>
                    <td align="right">
                        <asp:Button ID="btnUpload" runat="server" Text="Upload Selected Files" 
                            onclick="btnUpload_Click" />
                    </td>
                </tr>
            </table>
              
            <telerik:RadProgressArea runat="server" ID="RadProgressArea1">
            </telerik:RadProgressArea>
      
        </telerik:RadToolTip>
      
      
          
    </asp:Content>

    Code Behind:
    using System;
    using System.Data;
    using System.Data.SqlClient;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Web.UI;
      
    public partial class Dialogs_Photos : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lblPhotoType.Text = HttpContext.Current.Request.QueryString["PhotoType"];
                lblPhotoKey.Text = HttpContext.Current.Request.QueryString["PhotoKey"];
                lblPhotoSubKey.Text = HttpContext.Current.Request.QueryString["PhotoSubKey"];
            }
        }
      
        protected void ShowImage(object sender, RadRotatorEventArgs e)
        {
            if (e.Item is RadRotatorItem)
            {
                RadRotatorItem rotatorItem = (RadRotatorItem)e.Item;
                string PhotoID = (rotatorItem.FindControl("lblPhotoID") as Label).Text;
                string strTitle = (rotatorItem.FindControl("lblTitle") as Label).Text;
                string strDescription = (rotatorItem.FindControl("lblDescription") as Label).Text;
                RadBinaryImage thumbNail = (rotatorItem.FindControl("imgHiddenPhoto") as RadBinaryImage);
                imgPhoto.ImageUrl = thumbNail.ImageUrl;
                lblPhotoID.Text = PhotoID;
                txtPhotoTitle.Text = strTitle;
                txtPhotoDescription.Text = strDescription;
            }
        }
      
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            foreach (UploadedFile f in AsyncUpload1.UploadedFiles)
            {
                byte[] photo = EM_Functions.GetFileBytes(f.InputStream);
                photo = EM_Functions.ResizeImage(photo, 400);
                byte[] thumbnail = EM_Functions.ResizeImage(photo, 115);
                string fileType = EM_Functions.GetFileType(f.FileName);
                EM_Data.UploadPhoto(lblPhotoType.Text, int.Parse(lblPhotoKey.Text), 
                                    int.Parse(lblPhotoSubKey.Text), photo, thumbnail, f.FileName, fileType, 
                                    photo.Length, f.FileName, User.Identity.Name);
            }
      
            AsyncUpload1.Dispose();
            thumbRotator.DataBind();
        }
      
        protected void ibtnDeletePhoto_Click(object sender, ImageClickEventArgs e)
        {
            EM_Data.DeletePhoto(int.Parse(lblPhotoID.Text));
            thumbRotator.DataBind();
        }
      
        protected void ibtnSavePhoto_Click(object sender, ImageClickEventArgs e)
        {
            EM_Data.SavePhoto(int.Parse(lblPhotoID.Text), txtPhotoTitle.Text, txtPhotoDescription.Text);
            thumbRotator.DataBind();
        }
    }

  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1600 posts

    Posted 23 Nov 2010 Link to this post

    Hello Cliff Gibson,

    Please open your web site using FireFox and then look at the FireBug's console as upload fails. Is there error code present? Also, what is the size of the files that you are uploading? Further, please make sure that you have granted read/write permissions to the IIS account so that it can read/write to the temporary folder. Also, is the IIS version the same on production and on the dev box?

    Kind regards,
    Genady Sergeev
    the Telerik team
    Browse the vast support resources we have to jumpstart 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.
  3. Mohamed Azzouzi
    Mohamed  Azzouzi avatar
    1 posts
    Member since:
    Jun 2010

    Posted 26 Nov 2010 Link to this post

    Hi,
    I face the exact same problem. In development, everything works fine, but in production I am not able to upload files using RadAsyncUpload. The progress ring stays on - see attached.

    Development: Win 7 Enterprise, VS2010 Ultimate

    Production:
      * Win 2008 R2 Web and IIS7
      * The AppData/RadUploadTemp has Modify (including read/write) to the folder for the IIS AppPool user

    I have the RadAsyncUpload control within a formview. I am using form authentication too, and I have tried the fix in link to solution but it didn't work.

    The images I try to upload are less than 30kb.

    Firebug does not show any errors.

    Previously I used the old asp upload control and I could upload files. My problem started after enabling Ajax.

    Best regards,
    Mohamed Azzouzi
    Noitso
    www.noitso.dk
  4. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 02 Dec 2010 Link to this post

    Hi Mohamed Azzouzi,

    This information is insufficient enough for us to determine the cause of this issue.

    Could you please capture the traffic that is produced when you upload a file with FiddlerCap and attach here the logs so that we inspect them?

    Kind regards,
    Simon
    the Telerik team
    Browse the vast support resources we have to jumpstart 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.
Back to Top