Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
Hi,
I am using AjaxFileUpload control in my project. I am able to successfully implement and test functionality of this control on development machine. But after publishing on hosting server Ajax File Upload control stopped to work. On File upload it showing me file uploaded successfully with 100% progress but I am not able to find uploaded file on server.

Designer Code:
<pre lang="HTML">
<%@ Page Title="Add Banner – Website Content Management" Language="vb" AutoEventWireup="false" MasterPageFile="~/AdminPanel/Site.master" CodeBehind="AddBanner.aspx.vb" Inherits="Suvidhi.AddBanner" %>
<%@ Implements Interface="Idunno.AntiCsrf.ISuppressCsrfCheck" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div align="center"><h2>Upload Banner Images</h2></div>
    <div align="center">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
            <table>
                <tr>
                    <td align="left">Meta Title: </td>
                    <td>
                        <asp:TextBox ID="txtTitle" runat="server" Height="16px" MaxLength="70" 
                            Width="550px"></asp:TextBox></td>
                    <td style="width:150px;text-align:left;">
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                            ControlToValidate="txtTitle" Display="Dynamic" ErrorMessage="*" ForeColor="Red" 
                            SetFocusOnError="True"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" 
                            ControlToValidate="txtTitle" Display="Dynamic" ErrorMessage="Invalid Meta Title" 
                            ForeColor="Red" SetFocusOnError="True" 
                            ValidationExpression="^[0-9a-zA-Z .!@$%&-:'",.]+$"></asp:RegularExpressionValidator>
                    </td>
                </tr>
                <tr>
                    <td align="left">Meta Keyword: </td>
                    <td>
                        <asp:TextBox ID="txtKeyword" runat="server" Height="16px" MaxLength="170" 
                            Width="550"></asp:TextBox></td>
                    <td style="width:150px;text-align:left;">
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                            ControlToValidate="txtKeyword" Display="Dynamic" ErrorMessage="*" ForeColor="Red" 
                            SetFocusOnError="True"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                            ControlToValidate="txtKeyword" Display="Dynamic" ErrorMessage="Invalid Meta Keyword" 
                            ForeColor="Red" SetFocusOnError="True" 
                            ValidationExpression="^[0-9a-zA-Z .!@$%&-:'",.]+$"></asp:RegularExpressionValidator>
                    </td>
                </tr>
                <tr>
                    <td align="left" valign="top">Meta Description: </td>
                    <td>
                        <asp:TextBox ID="txtDescription" runat="server" Height="48px" MaxLength="160" 
                            Width="550" TextMode="MultiLine"></asp:TextBox></td>
                    <td style="width:150px;text-align:left;">
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                            ControlToValidate="txtDescription" Display="Dynamic" ErrorMessage="*" ForeColor="Red" 
                            SetFocusOnError="True"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                            ControlToValidate="txtDescription" Display="Dynamic" ErrorMessage="Invalid Meta Description" 
                            ForeColor="Red" SetFocusOnError="True" 
                            ValidationExpression="^[0-9a-zA-Z .!@$%&-:'",.]+$"></asp:RegularExpressionValidator>
                    </td>
                </tr>
                <tr>
                    <td align="left" valign="top">Category: </td>
                    <td>
                        <asp:DropDownList ID="cboCategory" runat="server" Width="100%">
                        </asp:DropDownList>
                    </td>
                    <td style="width:150px;text-align:left;">
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                            ControlToValidate="cboCategory" Display="Dynamic" 
                            ErrorMessage="Select Category" ForeColor="Red" 
                            SetFocusOnError="True"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td align="left" valign="top">Banner Image File: </td>
                    <td align="left">
                        <asp:AjaxFileUpload ID="AFUBanner" ThrobberID="imgUpload" runat="server" 
                            AllowedFileTypes="jpg,jpeg,gif,png" MaximumNumberOfFiles="1" />
                     </td>
                     <td style="width:150px;text-align:left;">
                         <asp:Label ID="lblImage" runat="server" ForeColor="Red"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td colspan="3" align="center">
                        <asp:Button ID="butSave" runat="server" Text="Save" Width="75px" />     <asp:Button 
                            ID="Clear" runat="server" Text="Clear" Width="75px" 
                            CausesValidation="False" /></td>
                </tr>
                <tr>
                    <td colspan="3" align="center">
                        <asp:Label ID="lblError" runat="server" ForeColor="red" Width="100%"></asp:Label></td>
                </tr>
            </table>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>


Code:
Private Sub AFUBanner_UploadComplete(sender As Object, e As AjaxControlToolkit.AjaxFileUploadEventArgs) Handles AFUBanner.UploadComplete
        Try
            Dim strPath As String = Server.MapPath("/") & "\AdminPanel\Temp\" & e.FileName
            lblError.Text = strPath
            lblError.Visible = True
            AFUBanner.SaveAs(strPath)
            Session("BannerImage") = strPath
        Catch ex As Exception
        End Try
End Sub



Please help me.
Thanks in advance.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900