Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

AjaxFileUpload runtime Error

$
0
0

hi all

I am using AjaxFileUpload for upload image. in asp.net c#

my code at below

in Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="AjaxUploadImage_Default" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title></title></head><body><form id="form1" runat="server"><div><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><cc1:AjaxFileUpload ID="AjaxFileUpload1" runat="server"
            AllowedFileTypes="jpg,jpeg,png,gif"
            MaximumNumberOfFiles="10"
            OnUploadComplete="File_Upload"
            Width="500px" /></div></form></body></html>

in Default.cs

using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using AjaxControlToolkit;

public partial class AjaxUploadImage_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void File_Upload(object sender, AjaxFileUploadEventArgs e)
    {
        string filename = e.FileName;
        string strDestPath = Server.MapPath("~/images/");
        AjaxFileUpload1.SaveAs(@strDestPath + filename);        
    } 

}

in Web.Config

<?xml version="1.0"?><!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  --><configuration><system.web><compilation debug="true" targetFramework="4.5"><assemblies><add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/><add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies></compilation><httpRuntime targetFramework="4.5"/></system.web></configuration>

error is

Unhandled exception at line 3422, column 28 in localhost:..

0x800a139e - JavaScript runtime error: Sys.ArgumentException: Cannot deserialize empty string.

Parameter name: data

 

Regards

DigiNaz


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>