Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to Download a file from the web.


4 replies to this topic

rjprasadch

rjprasadch
  • Full Members
  • 20 posts

Posted 26 July 2010 - 10:55

Hi,

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


Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 26 July 2010 - 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.
user posted image

rjprasadch

rjprasadch
  • Full Members
  • 20 posts

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\\"

STRING szSrcFile;

begin

szSrcFile = "Test.txt";

if (XCopyFile (SDIR ^ szSrcFile, TDIR ^ "*.*", COMP_NORMAL) < 0) then
MessageBox ("XCopyFile failed", SEVERE);
else
MessageBox ("Text files successfully copied.", INFORMATION);
endif;

end;

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 27 July 2010 - 14:59

Well, looking at your code, I was using a unsecured web site as opposed to a secure web site.

However, I also see a typo in the SDIR constant as it should be "www.yahoo" instead of "www\\yahoo".
user posted image

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 28 July 2010 - 02:07

Just for the record: downloading files from the Internet from your setup.exe is considered very bad practice. If you are targeting larger corporations with the software it is a great way to get your product axed since solving these designs for deployment via system accounts over the network is a bleeding nightmare. I have worked with deployment solutions in large companies, and deployment problems is high on the list of reasons to eliminate products when selecting...

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.
Regards
-Stein Åsmul