Click here to Skip to main content
15,885,852 members
Articles / Web Development / ASP.NET

Asynchronous File Upload

Rate me:
Please Sign up or sign in to vote.
4.96/5 (26 votes)
13 Jun 2014CPOL12 min read 126.8K   5K   103  
An Ajax control that enables a user to upload a file asynchronously with extra data
using System;
using System.Collections;
using System.Linq;
using System.Text;

namespace MyControls.Web
{
    public class AjaxUploadFileCollection : CollectionBase
    {
        private AjaxUploadGalleryExtender owner;
        public AjaxUploadFileCollection(AjaxUploadGalleryExtender owner)
        { this.owner = owner; }

        public void Add(AjaxUploadFile item)
        {
            this.InnerList.Add(item);
        }

        public void AddRange(AjaxUploadFile[] items)
        {
            if (items == null)
                throw new ArgumentNullException("items");

            foreach (AjaxUploadFile item in items)
                this.Add(item);
        }

        public bool Contains(AjaxUploadFile item)
        {
            return this.InnerList.Contains(item);
        }

        public int IndexOf(AjaxUploadFile item)
        {
            return this.InnerList.IndexOf(item);
        }

        public void Insert(int index, AjaxUploadFile item)
        {
            this.InnerList.Insert(index, item);
        }

        public void Remove(AjaxUploadFile item)
        {
            int index = this.IndexOf(item);
            if (index >= 0)
            {
                this.RemoveAt(index);
            }
        }

        public AjaxUploadFile this[int index]
        {
            get { return (AjaxUploadFile)this.InnerList[index]; }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Software Developer (Senior) The first Ones
Jordan Jordan
-- Life is Good.
and you can make it better

Comments and Discussions