PDA

View Full Version : download without prompt: the sequel


Shecky
03-23-2003, 12:41 PM
I found these code chunks on msdn. They say this will allow me to sliently download files to a specific location on the client. I guess i just dont understand the implementation... the top part looks really unfamiliar, i guess its VB script or something. Normally i would brush this off and say this doesnt belong in my web page code, but i'm not yet familiar with all of IEs insanity, and this kinda looked like somthing they'd do :)

The declaration for URLDownloadToFile is as follows:

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


The function can be called as follows:

returnValue = URLDownloadToFile(0, "http://www.microsoft.com/ms.htm", _
"c:\ms.htm", 0, 0)

Note that when downloading HTML files, embedded content like images and objects will not be downloaded.

I assure you my intentions are not malicious. If someone wants to private message me the response rather than posting it here, that would be great. I can also explain there why i need to used it.

the article reference is here (http://support.microsoft.com/default.aspx?scid=KB;en-us;q244757) and an example of implementation, which i didnt understand at all, is here (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwebteam/html/webteam03052001.asp) under the 'save the last gif for me' subheading.'

eggman
03-23-2003, 04:06 PM
urlmon.dll is a dynamic link library in MS Window's System folder. The declaration is Visual Basic, not VBScript, and is standard VB convention for linking to objects in external APIs. I'm sure they have an ActiveXObject version you can embed in HTML. Since I don't agree in principle with doing things to a user he didn't agree to, that's all I'll say on the subject.

Shecky
03-23-2003, 05:46 PM
well thats about the reception i expected.

Yer trying to download files in places the user doesnt want them! get out! :)

Honestly i'm just searching for a method here... i need to save 2 graphic files and 2 htm files to the users drive in a very specific location... i would just do a prompted "save as" 4 times, but its really a hassle for the user. If there were a method i could use where the user is prompted once for all four files that would be as idea as the 'silent' method.

I would put the files in some kinda fixed directory installer, but the files are partly user defined ( the jpgs are GD cropped/resized versions of pictures they specify... i dont know a method of packing these files into a web install using an automated php method. I doubt its possible.

I'm really pretty desperate here guys, if you can think of an acceptable way of transfering these 4 files to a certain folder on the client with any less pain than 4 saveas prompts, i'd love to hear!!!

joeframbach
06-02-2003, 01:36 AM
zip 'em up! www.winzip.com

Shecky
06-02-2003, 01:53 AM
Originally posted by joeframbach
zip 'em up! www.winzip.com

I'm generating images and pages from code... i need some kinda server side plugin that would zip these things automatically.

I'm pretty sure there are server-side zip makers for php/apache, i'd like a self-extracting kind... its important that certain files reside in certain folders.

glenngv
06-02-2003, 04:37 AM
I recommend zipping them up then tell the user where to extract the files. IMHO, I think that's acceptable to user, giving the user the option if he wants to save the files or not.

Shecky
06-02-2003, 12:02 PM
Originally posted by glenngv
I recommend zipping them up then tell the user where to extract the files. IMHO, I think that's acceptable to user, giving the user the option if he wants to save the files or not.

yer right... what i really wanted was a short list of reasons i shouldn't do it.. because I hadn't considered the alternatives.. in all the months since i originally posted this topic.

joh6nn
06-03-2003, 12:48 AM
php had a method for zipping things on the server side, though i think it's gzipping, and therefore of little use to. other than that, i can't tell you anything about it, since i don't know php.

i realize that my answer is 3 months late, but if you're still looking for a solution, you could try making a webpage, containing the 4 files you want people to download, and specifying that they should save it as "Webpage, Complete" which should download all the pictures on it. and i believe, that if you make it a framed page, you could include those 2 html files as frames, and they'd be downloaded as well.

i think that would do what you want, though the user would still have to save it to the right place.

i hope that's helpful, and i'm sorry i didn't see this thread sooner.

Shecky
06-03-2003, 01:08 AM
Originally posted by joh6nn
php had a method for zipping things on the server side, though i think it's gzipping, and therefore of little use to. other than that, i can't tell you anything about it, since i don't know php.

i realize that my answer is 3 months late, but if you're still looking for a solution, you could try making a webpage, containing the 4 files you want people to download, and specifying that they should save it as "Webpage, Complete" which should download all the pictures on it. and i believe, that if you make it a framed page, you could include those 2 html files as frames, and they'd be downloaded as well.

i think that would do what you want, though the user would still have to save it to the right place.

i hope that's helpful, and i'm sorry i didn't see this thread sooner.


It's kind of a special situation where, for the purpose of simplicity I'd just really like to have all the leg work done by some kind of installer. Anyway, I decided months ago that this forum wasn't going to give me the answer I was looking for... I'm exploring several possibilities, and I'm confident I'll overcome this problem eventually.