How To Add Attachment In An ASP Web Form, Does Not Upload To Server?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I'll keep it short and to the point since I'm amazed I got to this point but to preface I'm pretty new to anything coding related in general; most of my knowledge being from books, Youtube and google searches.
My question is:
How am I able to get the end-user to be able to attach a document(jpeg,png,etc) and email it to the specific sales rep of our company, without that document uploading to our server, through the use of an ASP form?
I created a form that my company uses to get super basic information from visitors. They would now like a picture attachment of their member ID to be sent as well through this form but not saved onto the server, simply attached and sent straight to the email of the sales representative.
This is what I have and I'm unsure if it's the best practice way, but it's what I've gathered from just code snippets, books, etc etc. I trimmed a lot of it so as to not make it super long and just get to the point of what I would like to do. So if something doesn't make sense, let me know I'll definitely try to clarify it better but I did get rid of a lot of the styling options and other fields asking for address, phone number, etc, as an example.
Default.aspx
<body>
<form id="form1" runat="server">
<table>
<tr>
<td> Full Name:
<asp:TextBox ID="Name" runat="server">
</asp:TextBox>
</td>
</tr>
</table>
<blockquote>
<p>
<asp:Button ID="Button1" runat="server" Text="Submit Member ID"
OnClick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="Reset Form"
OnClick="Button2_Click" />
</p>
</blockquote>
</form>
</body>
</html>
And the page on the backend that makes it work is the following:
Default.aspx.cs
using System;
using System.Net.Mail;
using System.Net;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
String strResult = "Member ID: Results rn rnResults: rn";
strResult += "Name: " + Name.Text + "rn";
MailAddress fromAddress = new MailAddress("mydomain@domain.com",
"Webmaster");
smtpClient.Host = "erelay.mydomain.com"; //"localhost";
smtpClient.Port = XX;
message.From = fromAddress;
message.To.Add("salesrep1@domain.com");
message.CC.Add("salesrepmanager@domain.com");
message.BccAdd("salesrepCEO@domain.com");
message.Subject = "Member ID";
message.IsBodyHtml = false;
message.Body = strResult;
smtpClient.Credentials = CredentialCache.DefaultNetworkCredentials;
smtpClient.Send(message);
Response.Redirect("thankyoupage@domain.com");
}
protected void Button2_Click(object sender, EventArgs e)
{
Name.Text="";
}
}
After that, the only thing they would like is the ability for members to attach their Member ID, either a scanned photo or what have you, to send along with the form. The scanned Member ID can be in JPEG, PNG, PDF, anything, it doesn't really matter, the only thing they don't want is the fact that it would upload to our server.
I've looked online and going through a bunch of examples and code snippets other have posted, and the closest I've got it to working is something like this in the HTML portion, say for example after asking for Name:
<tr>
<td>
<asp:FileUpload ID="FileUpload" runat="server" />
</td>
</tr>
And then in the backend, on the aspx.cs, adding it after the message.body
if (FileUpload.HasFile)
{
message.Attachments.Add(new Attachment(FileUpload.PostedFile.InputStream,
FileUpload.FileName));
}
I've also seen other code snippets that seem to temporarily create a location on the server and then self delete after it has been sent?
I've also tried making a third button like this to serve as an attachment but everything broke.
protected void Button3_Click
Hopefully this posting makes sense. I suggested the use of a third party site form site, but the company insists on this being internal. My other suggestion currently in place shows the actual email address on the form of where to send documentation to, but the company believes it's too many steps for the end-user and not all of them do it/skip that part.
The form itself works great, it sends the information to the representative that I add plus anyone that needs to be CC'd or Bcc'd on it.
If anyone could point me in the right direction I would also appreciate that as well. I've read a lot of documentation online as well of ASP.NET but it could be a bit unnerving for someone new.
Thank you for your time.
c# html asp.net forms
add a comment |
I'll keep it short and to the point since I'm amazed I got to this point but to preface I'm pretty new to anything coding related in general; most of my knowledge being from books, Youtube and google searches.
My question is:
How am I able to get the end-user to be able to attach a document(jpeg,png,etc) and email it to the specific sales rep of our company, without that document uploading to our server, through the use of an ASP form?
I created a form that my company uses to get super basic information from visitors. They would now like a picture attachment of their member ID to be sent as well through this form but not saved onto the server, simply attached and sent straight to the email of the sales representative.
This is what I have and I'm unsure if it's the best practice way, but it's what I've gathered from just code snippets, books, etc etc. I trimmed a lot of it so as to not make it super long and just get to the point of what I would like to do. So if something doesn't make sense, let me know I'll definitely try to clarify it better but I did get rid of a lot of the styling options and other fields asking for address, phone number, etc, as an example.
Default.aspx
<body>
<form id="form1" runat="server">
<table>
<tr>
<td> Full Name:
<asp:TextBox ID="Name" runat="server">
</asp:TextBox>
</td>
</tr>
</table>
<blockquote>
<p>
<asp:Button ID="Button1" runat="server" Text="Submit Member ID"
OnClick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="Reset Form"
OnClick="Button2_Click" />
</p>
</blockquote>
</form>
</body>
</html>
And the page on the backend that makes it work is the following:
Default.aspx.cs
using System;
using System.Net.Mail;
using System.Net;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
String strResult = "Member ID: Results rn rnResults: rn";
strResult += "Name: " + Name.Text + "rn";
MailAddress fromAddress = new MailAddress("mydomain@domain.com",
"Webmaster");
smtpClient.Host = "erelay.mydomain.com"; //"localhost";
smtpClient.Port = XX;
message.From = fromAddress;
message.To.Add("salesrep1@domain.com");
message.CC.Add("salesrepmanager@domain.com");
message.BccAdd("salesrepCEO@domain.com");
message.Subject = "Member ID";
message.IsBodyHtml = false;
message.Body = strResult;
smtpClient.Credentials = CredentialCache.DefaultNetworkCredentials;
smtpClient.Send(message);
Response.Redirect("thankyoupage@domain.com");
}
protected void Button2_Click(object sender, EventArgs e)
{
Name.Text="";
}
}
After that, the only thing they would like is the ability for members to attach their Member ID, either a scanned photo or what have you, to send along with the form. The scanned Member ID can be in JPEG, PNG, PDF, anything, it doesn't really matter, the only thing they don't want is the fact that it would upload to our server.
I've looked online and going through a bunch of examples and code snippets other have posted, and the closest I've got it to working is something like this in the HTML portion, say for example after asking for Name:
<tr>
<td>
<asp:FileUpload ID="FileUpload" runat="server" />
</td>
</tr>
And then in the backend, on the aspx.cs, adding it after the message.body
if (FileUpload.HasFile)
{
message.Attachments.Add(new Attachment(FileUpload.PostedFile.InputStream,
FileUpload.FileName));
}
I've also seen other code snippets that seem to temporarily create a location on the server and then self delete after it has been sent?
I've also tried making a third button like this to serve as an attachment but everything broke.
protected void Button3_Click
Hopefully this posting makes sense. I suggested the use of a third party site form site, but the company insists on this being internal. My other suggestion currently in place shows the actual email address on the form of where to send documentation to, but the company believes it's too many steps for the end-user and not all of them do it/skip that part.
The form itself works great, it sends the information to the representative that I add plus anyone that needs to be CC'd or Bcc'd on it.
If anyone could point me in the right direction I would also appreciate that as well. I've read a lot of documentation online as well of ASP.NET but it could be a bit unnerving for someone new.
Thank you for your time.
c# html asp.net forms
1
I am not sure because I haven't used webforms in years but in a normal form I think yo need to set theenctype="multipart/form-data"
this might be the same with a webform?
– John
Jan 3 at 13:56
I would encourage you to look into the ASP page lifecycle, as there seem to be some gaps in your understanding of what code runs on the server and what information is posted back when you submit a page. Whatever code you have on the code-behind of the page will execute on the server, which means that, unless you send the email with javascript or a mailto hyperlink, the file will most definitely get uploaded to the server once you submit the form/post the page back to the server
– ardila
Jan 3 at 14:09
@John Thanks for that, will definitely do more research in that regard. Yes, I've suggested the use of 3rd party form sites, but there's an insistence on using the internal one I made.
– NoviceG
Jan 3 at 16:09
@ardila Thank you as well for giving me some more information to look into. Yes, there's a lot of gaps in my knowledge, the fact that I've gotten this much done in about a months time is basically thanks to websites like this, google, books and Youtube. I'll look into ASP page lifecycle and explore other things you mentioned.
– NoviceG
Jan 3 at 16:11
add a comment |
I'll keep it short and to the point since I'm amazed I got to this point but to preface I'm pretty new to anything coding related in general; most of my knowledge being from books, Youtube and google searches.
My question is:
How am I able to get the end-user to be able to attach a document(jpeg,png,etc) and email it to the specific sales rep of our company, without that document uploading to our server, through the use of an ASP form?
I created a form that my company uses to get super basic information from visitors. They would now like a picture attachment of their member ID to be sent as well through this form but not saved onto the server, simply attached and sent straight to the email of the sales representative.
This is what I have and I'm unsure if it's the best practice way, but it's what I've gathered from just code snippets, books, etc etc. I trimmed a lot of it so as to not make it super long and just get to the point of what I would like to do. So if something doesn't make sense, let me know I'll definitely try to clarify it better but I did get rid of a lot of the styling options and other fields asking for address, phone number, etc, as an example.
Default.aspx
<body>
<form id="form1" runat="server">
<table>
<tr>
<td> Full Name:
<asp:TextBox ID="Name" runat="server">
</asp:TextBox>
</td>
</tr>
</table>
<blockquote>
<p>
<asp:Button ID="Button1" runat="server" Text="Submit Member ID"
OnClick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="Reset Form"
OnClick="Button2_Click" />
</p>
</blockquote>
</form>
</body>
</html>
And the page on the backend that makes it work is the following:
Default.aspx.cs
using System;
using System.Net.Mail;
using System.Net;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
String strResult = "Member ID: Results rn rnResults: rn";
strResult += "Name: " + Name.Text + "rn";
MailAddress fromAddress = new MailAddress("mydomain@domain.com",
"Webmaster");
smtpClient.Host = "erelay.mydomain.com"; //"localhost";
smtpClient.Port = XX;
message.From = fromAddress;
message.To.Add("salesrep1@domain.com");
message.CC.Add("salesrepmanager@domain.com");
message.BccAdd("salesrepCEO@domain.com");
message.Subject = "Member ID";
message.IsBodyHtml = false;
message.Body = strResult;
smtpClient.Credentials = CredentialCache.DefaultNetworkCredentials;
smtpClient.Send(message);
Response.Redirect("thankyoupage@domain.com");
}
protected void Button2_Click(object sender, EventArgs e)
{
Name.Text="";
}
}
After that, the only thing they would like is the ability for members to attach their Member ID, either a scanned photo or what have you, to send along with the form. The scanned Member ID can be in JPEG, PNG, PDF, anything, it doesn't really matter, the only thing they don't want is the fact that it would upload to our server.
I've looked online and going through a bunch of examples and code snippets other have posted, and the closest I've got it to working is something like this in the HTML portion, say for example after asking for Name:
<tr>
<td>
<asp:FileUpload ID="FileUpload" runat="server" />
</td>
</tr>
And then in the backend, on the aspx.cs, adding it after the message.body
if (FileUpload.HasFile)
{
message.Attachments.Add(new Attachment(FileUpload.PostedFile.InputStream,
FileUpload.FileName));
}
I've also seen other code snippets that seem to temporarily create a location on the server and then self delete after it has been sent?
I've also tried making a third button like this to serve as an attachment but everything broke.
protected void Button3_Click
Hopefully this posting makes sense. I suggested the use of a third party site form site, but the company insists on this being internal. My other suggestion currently in place shows the actual email address on the form of where to send documentation to, but the company believes it's too many steps for the end-user and not all of them do it/skip that part.
The form itself works great, it sends the information to the representative that I add plus anyone that needs to be CC'd or Bcc'd on it.
If anyone could point me in the right direction I would also appreciate that as well. I've read a lot of documentation online as well of ASP.NET but it could be a bit unnerving for someone new.
Thank you for your time.
c# html asp.net forms
I'll keep it short and to the point since I'm amazed I got to this point but to preface I'm pretty new to anything coding related in general; most of my knowledge being from books, Youtube and google searches.
My question is:
How am I able to get the end-user to be able to attach a document(jpeg,png,etc) and email it to the specific sales rep of our company, without that document uploading to our server, through the use of an ASP form?
I created a form that my company uses to get super basic information from visitors. They would now like a picture attachment of their member ID to be sent as well through this form but not saved onto the server, simply attached and sent straight to the email of the sales representative.
This is what I have and I'm unsure if it's the best practice way, but it's what I've gathered from just code snippets, books, etc etc. I trimmed a lot of it so as to not make it super long and just get to the point of what I would like to do. So if something doesn't make sense, let me know I'll definitely try to clarify it better but I did get rid of a lot of the styling options and other fields asking for address, phone number, etc, as an example.
Default.aspx
<body>
<form id="form1" runat="server">
<table>
<tr>
<td> Full Name:
<asp:TextBox ID="Name" runat="server">
</asp:TextBox>
</td>
</tr>
</table>
<blockquote>
<p>
<asp:Button ID="Button1" runat="server" Text="Submit Member ID"
OnClick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="Reset Form"
OnClick="Button2_Click" />
</p>
</blockquote>
</form>
</body>
</html>
And the page on the backend that makes it work is the following:
Default.aspx.cs
using System;
using System.Net.Mail;
using System.Net;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
String strResult = "Member ID: Results rn rnResults: rn";
strResult += "Name: " + Name.Text + "rn";
MailAddress fromAddress = new MailAddress("mydomain@domain.com",
"Webmaster");
smtpClient.Host = "erelay.mydomain.com"; //"localhost";
smtpClient.Port = XX;
message.From = fromAddress;
message.To.Add("salesrep1@domain.com");
message.CC.Add("salesrepmanager@domain.com");
message.BccAdd("salesrepCEO@domain.com");
message.Subject = "Member ID";
message.IsBodyHtml = false;
message.Body = strResult;
smtpClient.Credentials = CredentialCache.DefaultNetworkCredentials;
smtpClient.Send(message);
Response.Redirect("thankyoupage@domain.com");
}
protected void Button2_Click(object sender, EventArgs e)
{
Name.Text="";
}
}
After that, the only thing they would like is the ability for members to attach their Member ID, either a scanned photo or what have you, to send along with the form. The scanned Member ID can be in JPEG, PNG, PDF, anything, it doesn't really matter, the only thing they don't want is the fact that it would upload to our server.
I've looked online and going through a bunch of examples and code snippets other have posted, and the closest I've got it to working is something like this in the HTML portion, say for example after asking for Name:
<tr>
<td>
<asp:FileUpload ID="FileUpload" runat="server" />
</td>
</tr>
And then in the backend, on the aspx.cs, adding it after the message.body
if (FileUpload.HasFile)
{
message.Attachments.Add(new Attachment(FileUpload.PostedFile.InputStream,
FileUpload.FileName));
}
I've also seen other code snippets that seem to temporarily create a location on the server and then self delete after it has been sent?
I've also tried making a third button like this to serve as an attachment but everything broke.
protected void Button3_Click
Hopefully this posting makes sense. I suggested the use of a third party site form site, but the company insists on this being internal. My other suggestion currently in place shows the actual email address on the form of where to send documentation to, but the company believes it's too many steps for the end-user and not all of them do it/skip that part.
The form itself works great, it sends the information to the representative that I add plus anyone that needs to be CC'd or Bcc'd on it.
If anyone could point me in the right direction I would also appreciate that as well. I've read a lot of documentation online as well of ASP.NET but it could be a bit unnerving for someone new.
Thank you for your time.
c# html asp.net forms
c# html asp.net forms
asked Jan 3 at 13:54
NoviceGNoviceG
42
42
1
I am not sure because I haven't used webforms in years but in a normal form I think yo need to set theenctype="multipart/form-data"
this might be the same with a webform?
– John
Jan 3 at 13:56
I would encourage you to look into the ASP page lifecycle, as there seem to be some gaps in your understanding of what code runs on the server and what information is posted back when you submit a page. Whatever code you have on the code-behind of the page will execute on the server, which means that, unless you send the email with javascript or a mailto hyperlink, the file will most definitely get uploaded to the server once you submit the form/post the page back to the server
– ardila
Jan 3 at 14:09
@John Thanks for that, will definitely do more research in that regard. Yes, I've suggested the use of 3rd party form sites, but there's an insistence on using the internal one I made.
– NoviceG
Jan 3 at 16:09
@ardila Thank you as well for giving me some more information to look into. Yes, there's a lot of gaps in my knowledge, the fact that I've gotten this much done in about a months time is basically thanks to websites like this, google, books and Youtube. I'll look into ASP page lifecycle and explore other things you mentioned.
– NoviceG
Jan 3 at 16:11
add a comment |
1
I am not sure because I haven't used webforms in years but in a normal form I think yo need to set theenctype="multipart/form-data"
this might be the same with a webform?
– John
Jan 3 at 13:56
I would encourage you to look into the ASP page lifecycle, as there seem to be some gaps in your understanding of what code runs on the server and what information is posted back when you submit a page. Whatever code you have on the code-behind of the page will execute on the server, which means that, unless you send the email with javascript or a mailto hyperlink, the file will most definitely get uploaded to the server once you submit the form/post the page back to the server
– ardila
Jan 3 at 14:09
@John Thanks for that, will definitely do more research in that regard. Yes, I've suggested the use of 3rd party form sites, but there's an insistence on using the internal one I made.
– NoviceG
Jan 3 at 16:09
@ardila Thank you as well for giving me some more information to look into. Yes, there's a lot of gaps in my knowledge, the fact that I've gotten this much done in about a months time is basically thanks to websites like this, google, books and Youtube. I'll look into ASP page lifecycle and explore other things you mentioned.
– NoviceG
Jan 3 at 16:11
1
1
I am not sure because I haven't used webforms in years but in a normal form I think yo need to set the
enctype="multipart/form-data"
this might be the same with a webform?– John
Jan 3 at 13:56
I am not sure because I haven't used webforms in years but in a normal form I think yo need to set the
enctype="multipart/form-data"
this might be the same with a webform?– John
Jan 3 at 13:56
I would encourage you to look into the ASP page lifecycle, as there seem to be some gaps in your understanding of what code runs on the server and what information is posted back when you submit a page. Whatever code you have on the code-behind of the page will execute on the server, which means that, unless you send the email with javascript or a mailto hyperlink, the file will most definitely get uploaded to the server once you submit the form/post the page back to the server
– ardila
Jan 3 at 14:09
I would encourage you to look into the ASP page lifecycle, as there seem to be some gaps in your understanding of what code runs on the server and what information is posted back when you submit a page. Whatever code you have on the code-behind of the page will execute on the server, which means that, unless you send the email with javascript or a mailto hyperlink, the file will most definitely get uploaded to the server once you submit the form/post the page back to the server
– ardila
Jan 3 at 14:09
@John Thanks for that, will definitely do more research in that regard. Yes, I've suggested the use of 3rd party form sites, but there's an insistence on using the internal one I made.
– NoviceG
Jan 3 at 16:09
@John Thanks for that, will definitely do more research in that regard. Yes, I've suggested the use of 3rd party form sites, but there's an insistence on using the internal one I made.
– NoviceG
Jan 3 at 16:09
@ardila Thank you as well for giving me some more information to look into. Yes, there's a lot of gaps in my knowledge, the fact that I've gotten this much done in about a months time is basically thanks to websites like this, google, books and Youtube. I'll look into ASP page lifecycle and explore other things you mentioned.
– NoviceG
Jan 3 at 16:11
@ardila Thank you as well for giving me some more information to look into. Yes, there's a lot of gaps in my knowledge, the fact that I've gotten this much done in about a months time is basically thanks to websites like this, google, books and Youtube. I'll look into ASP page lifecycle and explore other things you mentioned.
– NoviceG
Jan 3 at 16:11
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54023701%2fhow-to-add-attachment-in-an-asp-web-form-does-not-upload-to-server%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54023701%2fhow-to-add-attachment-in-an-asp-web-form-does-not-upload-to-server%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I am not sure because I haven't used webforms in years but in a normal form I think yo need to set the
enctype="multipart/form-data"
this might be the same with a webform?– John
Jan 3 at 13:56
I would encourage you to look into the ASP page lifecycle, as there seem to be some gaps in your understanding of what code runs on the server and what information is posted back when you submit a page. Whatever code you have on the code-behind of the page will execute on the server, which means that, unless you send the email with javascript or a mailto hyperlink, the file will most definitely get uploaded to the server once you submit the form/post the page back to the server
– ardila
Jan 3 at 14:09
@John Thanks for that, will definitely do more research in that regard. Yes, I've suggested the use of 3rd party form sites, but there's an insistence on using the internal one I made.
– NoviceG
Jan 3 at 16:09
@ardila Thank you as well for giving me some more information to look into. Yes, there's a lot of gaps in my knowledge, the fact that I've gotten this much done in about a months time is basically thanks to websites like this, google, books and Youtube. I'll look into ASP page lifecycle and explore other things you mentioned.
– NoviceG
Jan 3 at 16:11