Go Back To Code List
[C#]
Current Code Entry
Next Code Entry
Create an XML Sitemap or data feed with ASP.NET using C#
C# - Upload Multiple Files with Thumbnail, Folders, and SQL Server Database
Article Entry Date: June 14,2022 @ 05:31:27 / Last Updated On: September 29,2022 @ 11:02:56
For VB.NET developers. VB.NET - Upload Multiple Files with Thumbnail, Folders, and SQL Server Database«

    What this script does.
  1. June 14, 2022 - Ported over from VB.NET to C#, this upload script is very robust, allowing you to upload many files. Easily changed in the web.config file and the JS script.
  2. Page checks if there is a QueryString["ID"] available. If not, a warning is given with a link to click. The buttons on the page are also disabled until a valid ID is present. This part can be expanded to include a check against a database to ensure the user who uploads the images has a valid ID and is logged in to their account before everything is set and available.
  3. If the file is larger than the set file size, it will show an error, and the file will not be available for uploading.
  4. Create two folders, Big and Thumbs, with the ability to add more folders easily within the aspx.vb file and within the web.config file.
  5. Images are resized using the resizeImage() function. Images are not only smaller in diameter but pixel size as well.
  6. Information inserted into SQL Server Database. (Included Table Script)

The database table information is listed here.
    Table name: ImageServer
  1. [PicsID] [int] IDENTITY(1,1) NOT NULL,
  2. [PicsFolder] [nvarchar](50) NULL,
  3. [Userid] [int] NULL,
  4. [DefaultFolder] [int] NULL,
  5. [PicsPath] [varchar](255) NULL,
  6. [PicsName] [nvarchar](50) NULL,
  7. [PicsSize] [int] NULL,
  8. [PicWH] [varchar](50) NULL,
  9. [PicDate] [datetime] NULL,
  10. [DateUpdated] [datetime] NULL,