|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Attaching and mailing an image
Firstly, Whenever you want to attach anything with a mail, u press the 'Attach' button and a window shows up in which you can find the file to be attached and give its path. How is that possible in an ASP.NET page ?
Secondly, if the file path is selected in the manner explained above, how can I actually mail the attached image to any email address using VB code? Basically a user selects the image he wants to use while registering on my website and i want that image to somehow come on the server so that i can use it on the ASP webpages. I am totally blank about these concepts, kindly elaborate in detail. Thank you. ![]() |
|
#2
|
||||
|
||||
|
I'll get you started.
Since we are doing this in asp.net all the actions you describe must happen on the server. To attach a file to an email, you must first get that file up to the server somewhere. To do this use the serverside file input control Code:
<input type=file runat=server id=file1> you can then copy that file selected up to the server Code:
Public Sub PostFile
dim path as string
path = server.mappath("the directory on the server you want to copy the file too")
'to retain the files original name you need to parse it out
dim filename() as string
filename = split(file1.postedfile.filename ,"\") 'load the full path into an array
'now build the destination for your file
dim Destination as string
Destination = path & "\" & filename(ubound(filename))
'finally save the file to your server
File1.PostedFile.SaveAs(Destination)
End Sub
To email the file you can use the CDONTS object |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Attaching and mailing an image |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|