Uplode filer til MS´s mailmessage
Jeg har lavet en mailmessage efter MS eksempel. Se:<!-- http://msdn.microsoft.com/en-us/library/system.web.mail.mailmessage.aspx -->
Det virker pånær attached file. Men MS skriver heller ikke hvordan man skal lave det.
Til at uplode filer har jeg brugt:
<asp:FileUpload id="FileUpload1" runat="server" Width="305px" />
<asp:Button id="UploadButton" Text="Upload file" OnClick="UploadButton_Click" runat="server" Width="70px"> </asp:Button>
Sub UploadButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
' Specify the path on the server to
' save the uploaded file to.
Dim savePath As String = "c:\temp\uploads\"
' Before attempting to perform operations
' on the file, verify that the FileUpload
' control contains a file.
If (FileUpload1.HasFile) Then
' Get the name of the file to upload.
Dim fileName As String = FileUpload1.FileName
' Append the name of the file to upload to the path.
savePath += fileName
' Call the SaveAs method to save the
' uploaded file to the specified path.
' This example does not perform all
' the necessary error checking.
' If a file with the same name
' already exists in the specified path,
' the uploaded file overwrites it.
FileUpload1.SaveAs(savePath)
' Notify the user of the name the file
' was saved under.
txtAttach.Text = fileName
Else
' Notify the user that a file was not uploaded.
txtAttach.Text = ""
End If
Jeg får (selvfølgelig) fejlen c:\temp\uploads\ ikke findes på serveren.
Hvordan får man filerne loded ind????