Get the App
SLTechnology News&Howtos  ›  Development  › 

How to make the avatar effect with Asp.net FileUpload+Image

Shulou Source: shulou.com Published: 2022-06-03 07:18:25 11月15日 Update

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

Tags: File picture code path size control type format effect content name attribute avatar production unit byte client width more server Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Docker Shulou Information Shulou Tech Info OPPO Reno