Click here to Skip to main content
15,890,897 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I have a windows forms application. I use the following code to open a dialog where user selects a PDF file.

VB
Dim myFile As New OpenFileDialog()
 myFile.Filter = "Pdf Files (*.pdf)|*.pdf|All Files (*.*)|*.*"
      If myFile.ShowDialog() = _
              DialogResult.OK Then
        If Dir(myFile.FileName) <> "" Then
          MsgBox("File Exists: " & _
                 myFile.FileName, _
                 MsgBoxStyle.Information)
        Else
          MsgBox("File Not Found", _
                 MsgBoxStyle.Critical)
        End If
      End If

Now I want this PDF file to be saved on my server/FTP. How to achieve this?
Please tell me without using any prompts or dialogs that means, I specify the server address/ FTP address in code and it should save in there.
Posted
Updated 19-Dec-14 7:31am
v2
Comments
MasterCodeon 19-Dec-14 13:20pm    
hey quick tip: when you post something its easier for everyone to see your code when you wrap it in a language specific code tags. just click the code button and click the language that you are inputting
here is the tag you would use for VB:
<pre lang="vb">Put your code here</pre>
MasterCodeon 19-Dec-14 13:22pm    
if you want to, you can improve your question and out the VB code tag around your code to help everyone see it better
MasterCodeon 19-Dec-14 13:34pm    
well i would first declare your username and password for your FTP server
Sergey Alexandrovich Kryukov 19-Dec-14 13:40pm    
Is this code on the server side where you FTP server or not? If it is, just save the file; if not, act as an FTP client.
—SA
MasterCodeon 19-Dec-14 13:46pm    
if i where you i would also put the name of the path\name of the file into a variable.
i did it like this:
Dim SelectedFile As String = myFile.FileName.ToString()
Note: i put this at the bottom of your code snippet.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900