Attach a file in asp net
Md Shahriar Md Shahriar 1, 9 9 silver badges 9 9 bronze badges. Here is a code Add "xx xxxx. MapPath VirtualPathUtility. SmtpClient " Send msg ; msg. Dispose ; ScriptManager. RegisterStartupScript this, this.
Ratna Ratna 2, 2 2 gold badges 23 23 silver badges 48 48 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog.
Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Trim ;. Add new MailAddress txtTo. Add new Attachment file. InputStream, Path. GetFileName file. FileName , file. ContentType ;. NetworkCredential ;. Send mailMessage ;. Remove this. Key ;. Redirect Request. AbsoluteUri ;. Add New MailAddress txtTo.
Add New Attachment file. Dim smtp As New SmtpClient. Send mailMessage. End Using. Remove Me. Related Articles. Add Comments. Thank you for the feedback. The comment is now awaiting moderation. Add a Solution. Top Rated Most Recent. Accept Solution Reject Solution. You can convert the image to base64 and save it as a string. Keep the field of nvarchar max in datatable. Convert image to base Posted 9-Apr am Rohan Dhamecha.
Dear, the image is on the Client's machine and your code shows server path? You will need to have a server side script to process the form and save the file. Posted 9-Apr am MadMyche. Add your solution here. OK Paste as. Treat my content as plain text, not as HTML. Existing Members Sign in to your account.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. You can add new and existing files to an ASP. NET Web site. Some file types can only exist in special ASP. NET subdirectories. For example, browser definition files. For a list of file types, see Web Site File Types.
0コメント