
October 10th, 2000, 06:25 AM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,575
  
Time spent in forums: < 1 sec
Reputation Power: 24
|
|
<i><b>Originally posted by : ManjuC (manjuc@web-xess.net)</b></i><br />Hi,<br /><br />method 1<br />-------<br /><br />If u just want to send a file using an email, u can use the following code... this will work assuming the client have a default email configured and it support files... (the file he/she want to send to u will be attached to the email as a normal attachement.) also note that u can specify a subject and the body of the text on the Form header....<br /><br />but there is a catch: u can't get input text box values this way!!! to get them u need to specify this on the form header...<br /><br />enctype="text/plain" <br /><br />but if u specify that, the file won't get attached!!! hehe... so I suggest u use 2 form tags and use 2 submit buttons... resulting in 2 emails instead of one... and as u can see this is a very primitive way to do it all.<br /><br />if u're fine with it just cut and paste the code from the dotted lines and u're on ur way. (this code will attach the file u want to upload but won't get the input textbox values)<br /><br />-----------------<br /><br /><html><br /><br /><head><br /><title>test page</title><br /></head><br /><br /><body><br /><br /><form method="POST" action="mailto:manju@ins.com.sa?Subject=This the the subject of the email&Body=hi this goes inside the body of the email"><br /> <p><input type="file" name="filename" size="20"></p><br /> <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p><br /></form><br /><br /></body><br /><br /></html><br /><br />-----------------<br /><br /><br /><br />method 2<br />-------<br /><br />If u want to upload the file to a database or get the file uploaded plus the values and fire an email using CDONTS, or a specific folder in ur web server u need to write a bit of complex code... <br /><br />on the backend to grab the file. if u're familiar with ASP u can try to write it urself.<br /><br />as for the (front end) user, u need to put a input file form box... as u would insert any form item. by using the following code:<br /><br /><input type="file" name="name_this_anything_U_want"><br /><br />this will give u an empty text box plus a browse button (to select the file)<br /><br />also u should need to set the form tag to <br /><form method="POST" enctype="multipart/form-data" <br /><br />if not it won't upload the file. the enctype="multipart/form-data" is very important. <br /><br />that is it for the form goes...<br /><br />but to get the actual file from the asp u need to get the name from the file u selected to upload box using the name "name_this_anything_U_want" (as I named it above).<br /><br />to assist u in writing the code to actually get the file look at fileupload tutorials at asptoday.com or goto aspalliance.com and click on Charles Carroll and see the tutorial on fileupload.<br /><br />Or (this is easier)<br /><br />u can use a 3rd party component for file uploading. I use software atisians SAFileUP. I suggest u use a 3rd party component since it'll save a lot of hassle. this will enable u to have more control over what u upload plus lotsa options.<br /><br />hope this helps,  )<br /><br />problemo? fire email my way, (manjuc@web-xess.net)<br /><br />ManjuC<br /><br />
|