Downloader.SessionStartToFile method |
|
Remarks
Starts a download session of a remote file pointed by a URL and stores the downloaded file inside a given pathname using the same filename of the remote file: in case the file name couldn't be determined from the URL
A successful call to this method allows the container application the be notified about the advancement through the CallbackForDownloaderEvents delegate which is invoked with the nEvent parameter set to one of the following values:
- the EV_DOWNLOADER_SESSION_STARTED event reports that the downloading session is started
- the EV_DOWNLOADER_SESSION_PROGRESS event informs about the download advancement expressed in percentage
- the EV_DOWNLOADER_SESSION_COMPLETED event reports that the downloading session is completed successfully
In case the connection to the remote server or the access to the remote file should fail, the CallbackForDownloaderEvents delegate is invoked with the nEvent parameter set to EV_DOWNLOADER_SESSION_FAILED.
In case the connection should be stopped by the user through a call to the Downloader.SessionStop method, the CallbackForDownloaderEvents delegate is invoked with the nEvent parameter set to EV_DOWNLOADER_SESSION_STOPPED.
For details about management of download sessions from HTTP and FTP servers, refer to the How to manage download sessions tutorial.
Syntax
[Visual Basic] Public Function SessionStartToFile ( strURL as String, strUsername as String, strPassword as String, strDestinationPath as String, bDisableCache as Boolean ) as Int32 |
[C#] public Int32 SessionStartToFile ( string strURL, string strUsername, string strPassword, string strDestinationPath, bool bDisableCache ); |
[C++] public: Int32 SessionStartToFile( string strURL, string strUsername, string strPassword, string strDestinationPath, bool bDisableCache ); |
Parameter |
Description |
||||||
|
|
||||||
strURL |
String containing the URL pointing to the remote media file to download. Accepted Internet protocols for the passed URL must be of type HTTPS, HTTP or FTP. |
||||||
strUsername |
String containing the username for accessing the server. Leave the string empty if the directory containing the remote file is not username protected. |
||||||
strPassword |
String containing the password for accessing the server. Leave the string empty if the directory containing the remote file is not password protected. |
||||||
strDestinationPath |
String containing the path on the local system where the downloaded file will be stored: the path must not contain the filename, indeed the same filename of the remote file will be used for creating the local file copy. In case the URL should not point to a file directly, the component will try to compose a filename using the latest folder of the URL and the ".download" extension; in this case, once the download session is started and the CallbackForDownloaderEvents delegate is invoked with its nEvent parameter set to EV_DOWNLOADER_SESSION_STARTED, you may verify the exact full pathname of the downloaded file by invoking the Downloader.SessionPathnameGet method. |
||||||
bDisableCache |
Flag for determining if the usage of the Internet cache must be disabled or not. Supported values are the following:
|
Return value
Value |
Meaning |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
Value >= 0 |
The method call was successful and the returned value is the unique identifier of the download session. |
||||||||||||||||||||||||||||||
Negative value |
An error occurred: see the LastError property for error details or for a list of the possible error values. In case the error code should be ERR_DOWNLOADER_REMOTE_FILE_FAILURE or ERR_DOWNLOADER_LOCAL_FILE_FAILURE the Downloader.LastFileExceptionGet method would provide the nature of the error which may assume one of the following values:
|