Avatar billede per2edb Praktikant
08. februar 2011 - 18:23 Der er 1 løsning

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????
Avatar billede per2edb Praktikant
27. februar 2011 - 12:08 #1
lukket
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester