Get email attachment size in asp.net

Is there a way to find out the size of the attachment that is sent in an email in asp.net C #?

thank!

+3
source share
3 answers

If you use System.Net.Mailand attach a file using a class Attachment, then each attachment must have a ContentStreamproperty containing the actual file. This type property Streamhas a property Length(type long) that gives the file size in bytes.

+4
source

Usually base64 attachments are encoded in System.Net.Mail. base64 takes 3 bytes and converts them to 4 bytes.

, ( Stream.Length, , ), .75.

, base64, SMTP.

+1

I believe you can use the HttpFileCollection class. It gives you access to all files uploaded by the client. Here is the msdn link

0
source

All Articles