How to make the avatar effect with Asp.net FileUpload+Image
This article is to share with you about how Asp.net FileUpload+Image creates avatars. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Introduction to use of FileUpLoad Control
The PostedFile property of the FileUpLoad control mainly gets some basic information about the uploaded file.
.ContentLength
Gets the size of the uploaded file. The return value is of type int, in bytes.
Use
1. Judge the size of the uploaded file
If (this.FileUpload1.PostedFile.ContentLength
.axps.cs
The copy code is as follows:
Using System
Using System.Collections.Generic
Using System.Linq
Using System.Web
Using System.Web.UI
Using System.Web.UI.WebControls
Namespace Testcookie
{
Public partial class Fileup: System.Web.UI.Page
{
Protected void Page_Load (object sender, EventArgs e)
{
}
Protected void btnupload_Click (object sender, EventArgs e)
{
Int length= this.FileUpload1.PostedFile.ContentLength;// gets the image size in bytes
If (length