Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET Ajax VB.NET
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" />&nbsp&nbsp&nbsp&nbsp&nbsp<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 28-Jun-13 13:15pm

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

  Print Answers RSS
0 OriginalGriff 250
1 George Jonsson 175
2 Jochen Arndt 150
3 Kornfeld Eliyahu Peter 149
4 PIEBALDconsult 110
0 OriginalGriff 6,080
1 DamithSL 4,648
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,624
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 28 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100