vb.Net Why does my file downloaded from my FTP server is not saved in the folder you create from my application in vb.Net? These compiling your application in vb.Net to download files from FTP server and all leaves you perfectly, that is, connect to the FTP Server, your downloaded file is saved in the folder you've assigned from source in the path of your application by default, ie "c: \\ Program Files \\ My Application \\ FTP Files \\ file.doc. " Suddenly, you go to another machine, install your application to test (As you have to brag) and you realize that your downloaded file that supposedly does not appear in the folder you want what happened?
The reason for this little problem?: To be honest I'm not sure but it appears that this is the Windows permissions as these folders are special and can not be altered from a source other than the user's direct actions same as save, delete, modify files (which contain) from the inside, on the contrary because we want to alter from an intermediate source using our application, we would need a special code that allows us to do just these actions within folders in question.
Gentlemen, I would recommend the following: Avoid downloading in a direction which may include operating system folder (Windows, Program Files, My Documents, etc), commonly (I assume) would for example "c: \\ Program Files \\ My System \\ FTP Files \\ file.doc "because it could cause an error or at least show no error ! but instead not save the file! (What happened in my case), so avoid it and do not complicate, I suggest you save it to another drive or eg "C: \\ Archid FTP." O If you get some code or property that allows us to perform these actions please share them man!, much better if publicais our blog, your alternative solution.
Here I leave the code to guide vb.Net:
Dim filepath As String
'If the folder where we want to keep our files not created, because they believe, what we as
If Not Directory.Exists ( "C: \\ FTP" ) Then
Directory.CreateDirectory ( "C: \\ FTP" )
End If
filepath = "c : \\ FTP Files \\ archivodescargado.doc "
'important, it is necessary to check if the file already exists to open or run (if that's your intention) directly and not send another Once the download request FTP server
If Not File.Exists (filepath) Then
Try
DescargarArchivoFTP (filepath, "archivodescargado.doc" ) 'Click here for the procedure in which the file download
Catch ex As Exception
MsgBox(ex.Message)
Exit Sub
End Try
End If
End If
Try
System.Diagnostics.Process.Start (filepath) 'if your intension is to open the file oejecutar
GrabarEstado ()
Catch ex As Exception
MsgBox (ex.Message)
End Try
0 comments:
Post a Comment