How to Download a file from the web.
Posted 26 July 2010 - 10:55
We are using installshield and we are having one installscript project. We have a below requirement.
One text file will be there in a particualar website and we need to download that text file from the web and need to copy the file in c:\ drive in the local machine. For this requirement, we are trying with XCopyFile(), but it is not working. Can anyone please let me know how we can download a file from the web in Installscript projects. Whether we can use XCOpy file or any other features are there.
For example, my requirement is “need to download a file “Test.txt” from www.yahoo.com and copy the downloaded file in C:\ drive in local machine.How to do this in installscript projects.
Thanks for your help in advance
Posted 26 July 2010 - 14:39
Posted 26 July 2010 - 15:20
|QUOTE (Taco Bell @ 2010-07-26 14:39)|
|I would recommend that you try using CopyFile() instead of XCopyFile() since it's just one file and since I've successfully used that to download files from a web site.|
Thanks for your rely. Using XCopyfile, i have tried with following piece of code.But it is not working. Can you please let me know if i am missing anything in the below code. Can you please let me know whether URL mentioned is in the correct format.
#define SDIR "https:\\www\\yahoo.com\"
#define TDIR "C:\\File Download\\"
szSrcFile = "Test.txt";
if (XCopyFile (SDIR ^ szSrcFile, TDIR ^ "*.*", COMP_NORMAL) < 0) then
MessageBox ("XCopyFile failed", SEVERE);
MessageBox ("Text files successfully copied.", INFORMATION);
Posted 27 July 2010 - 14:59
However, I also see a typo in the SDIR constant as it should be "www.yahoo" instead of "www\\yahoo".
Posted 28 July 2010 - 02:07
I would only consider doing this if the target group does not include large corporations, the installation base is small and the design genuinely contributes positively to the overall "ease of use" for the user. In other words it really eliminates tedious manual setup for the user.
A simple alternative solution is to have your main application EXE file perform the download of the file after the installation is complete. Apart from corporate deployment problems, Internet usage from the setup can also trigger serious deployment problems in relation to anti virus software, firewalls and perhaps even network issues with NAT translation (though this isn't so much of a problem these days I think).
A failed setup experience means your product literally never gets evaluated and appreciated for whatever it is. The setup failure is a great place to give up for people with options.