Can I upload / Download a file from my ftp server with many sections
Printable View
Can I upload / Download a file from my ftp server with many sections
Look @ MS Internet Transfer control (aka INet).
Also, what does "many sections" mean?
Or you can use this api call instead of adding a control to your project:
VB Code:
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long Private Declare Function DeleteUrlCacheEntry Lib "Wininet.dll" Alias "DeleteUrlCacheEntryA" (ByVal lpszUrlName As String) As Long Private Const S_OK As Long = &H0 Private Const BINDF_GETNEWESTVERSION As Long = &H10
VB Code:
Dim lngFile As Long Dim strSourceURL As String Dim strLocalFile As String Dim strUpdateInformation() As String Dim strMessage As String strSourceURL = "http://www.yourlinkhere.com/NameOfDownloadFile.zip" strLocalFile = App.Path & "\NameOfDownloadFile.zip" Call DeleteUrlCacheEntry(strSourceURL) 'In case you had a cached copy of file, this deletes the cached file If URLDownloadToFile(0&, strSourceURL, strLocalFile, BINDF_GETNEWESTVERSION, 0&) = S_OK Then 'File was downloaded correctlty Else 'There was an error End If
The INet control would be better, as that code above only allows for downloading.
chem
My download manager download files as some parts. I want to download file like that. I mean that by many sections.
I am clueless as to what it means... :confused: :confused: :confused:Quote:
Originally Posted by thamizhinpan
Can anybody clarify please?
i think he refers "parts" as in chunks. as in a 64k file downloaded in 8k sections, chunks are great if you want to resume where you left off when disconnected. or can be used in file sharing apps, where you can download 1 chunk from someone and 3 from someone else.
edit:
usually they have a CRC for each chunk of data to ensure its correctly downloaded, if the CRC is not matching then you don't have to download the whole thing over, just the corrupted chunk of data.
You are correct Billy Conner
In my country the internet connection is not work properly. So I use this method to
download big file.
I know that, I can't download files like Virus definitions (often changing files).
How can I use this method to Download and upload files from my FTP server?
I'm having one problem here, with this line:Quote:
Originally Posted by rami.haddad
strLocalFile = App.Path & "\NameOfDownloadFile.zip"
Its telling me App is not declared, how would I go about declaring it?
You don't - that is Classic VB code, and I guess you are using VB.Net (VB 200x).
App.Path returns the folder that the program is running from, so you'll need to use the equivalent (perhaps Application.Path ?) or a fixed path.
Sorry I have use VB 6. My main problem now is I want to use my program on any computers with out installations. INet control have not placed on some computers. So I like to use API. IS it work on any computers?
It doesn't matter what you want - as you are using VB, your program will need to be installed anyway. If you don't want to have an installation for your program, don't use VB to make it.
Having an extra file to install is not something you should worry about.
works for me.thanksQuote:
Originally Posted by rami.haddad
Sure it works but it is only for downloading, not both.
yeah, i use it for download :D
As I have API-Guide installed on my lappy, I did a search for all APIs starting with FTP, and there are 9 listed there, two of which are FTPGetFile and FTPPutFile, which may come in handy here.
i figured you would need to use winsock to do resuming, i found an example here
http://www.trap17.com/index.php/ftp-...-0_t56358.html usind winsock, so you will have to package winsock with your program, unless you want to figure how to convert to using winsock API