Direct file download

Discussion in 'Javascript' started by raymond_b_jimenez@yahoo.com, Oct 28, 2008.

  1. Guest

    I need to download a file from an Intranet web site and feed it into a
    program on the PC where the browser is running. Browser is Internet
    Explorer. Both Javascript and VBscript are options.
    Which would be my best options? Examples would be welcomed!
    rj
    , Oct 28, 2008
    #1
    1. Advertising

  2. David Mark Guest

    On Oct 28, 5:28 pm, wrote:
    > I need to download a file from an Intranet web site and feed it into a
    > program on the PC where the browser is running. Browser is Internet


    That's one of the things that browsers do.

    > Explorer. Both Javascript and VBscript are options.


    IE can do it as it is a browser. Script is not required.

    > Which would be my best options? Examples would be welcomed!
    > rj


    Push out a blob of registry entries to associate the file type with
    the program, map the appropriate MIME type to the file type, adjust
    security settings, etc. These are tasks for your Intranet
    administrator.
    David Mark, Oct 28, 2008
    #2
    1. Advertising

  3. Tom Lavedas Guest

    On Oct 28, 5:28 pm, wrote:
    > I need to download a file from an Intranet web site and feed it into a
    > program on the PC where the browser is running. Browser is Internet
    > Explorer. Both Javascript and VBscript are options.
    > Which would be my best options? Examples would be welcomed!
    > rj


    Maybe this will help (doesn't need browser):

    http://groups.google.com/group/microsoft.public.scripting.vbscript/msg/a920d6c8e247f1fa

    Once the file is available on the local machine, use the Wscript.Shell
    in your script to start the application referencing the local file ...

    sDownLoadedFile = "d:\somewhere\filename
    with CreateObject("Wscript.Shell")
    .Run "d:\location\your_application.exe " & sDownLoadedFile , 0, True
    end

    Tom Lavedas
    ===========
    http://members.cox.net/tglbatch/wsh/
    Tom Lavedas, Oct 29, 2008
    #3
  4. Guest

    Thanks Tom. I had seen the code, I tested it again, but it doesn't
    work. It won't execute
    With CreateObject("ADODB.Stream")
    Seems like the example is server side code, but I need it to run on
    the client. Can you confirm the code sample can be executed in
    VBScript on the client browser?
    rj

    On Oct 29, 2:12 pm, Tom Lavedas <> wrote:
    > On Oct 28, 5:28 pm, wrote:
    >
    > > I need to download a file from an Intranet web site and feed it into a
    > > program on the PC where the browser is running. Browser is Internet
    > > Explorer. Both Javascript and VBscript are options.
    > > Which would be my best options? Examples would be welcomed!
    > > rj

    >
    > Maybe this will help (doesn't need browser):
    >
    > http://groups.google.com/group/microsoft.public.scripting.vbscript/ms...
    >
    > Once the file is available on the local machine, use the Wscript.Shell
    > in your script to start the application referencing the local file ...
    >
    > sDownLoadedFile = "d:\somewhere\filename
    > with CreateObject("Wscript.Shell")
    >   .Run "d:\location\your_application.exe " & sDownLoadedFile , 0, True
    > end
    >
    > Tom Lavedas
    > ===========http://members.cox.net/tglbatch/wsh/
    , Oct 29, 2008
    #4
  5. Guest

    Thanks David,
    The idea is that the user only clicks once and generates the whole
    process. I cannot associate the file type because they are doc files,
    and they have to be openable by Word in Windows. The idea is to pass
    them through another application. My main problem is downloading the
    file to a special directory (temp directory) without the user having
    to select it.
    rj

    On Oct 28, 9:38 pm, David Mark <> wrote:
    > On Oct 28, 5:28 pm, wrote:
    >
    > > I need to download a file from an Intranet web site and feed it into a
    > > program on the PC where the browser is running. Browser is Internet

    >
    > That's one of the things that browsers do.
    >
    > > Explorer. Both Javascript and VBscript are options.

    >
    > IE can do it as it is a browser.  Script is not required.
    >
    > > Which would be my best options? Examples would be welcomed!
    > > rj

    >
    > Push out a blob of registry entries to associate the file type with
    > the program, map the appropriate MIME type to the file type, adjust
    > security settings, etc.  These are tasks for your Intranet
    > administrator.
    , Oct 29, 2008
    #5
  6. Tom Lavedas Guest

    On Oct 29, 11:42 am, wrote:
    > Thanks Tom. I had seen the code, I tested it again, but it doesn't
    > work. It won't execute
    >     With CreateObject("ADODB.Stream")
    > Seems like the example is server side code, but I need it to run on
    > the client. Can you confirm the code sample can be executed in
    > VBScript on the client browser?
    > rj
    >
    > On Oct 29, 2:12 pm, Tom Lavedas <> wrote:
    >
    > > On Oct 28, 5:28 pm, wrote:

    >
    > > > I need to download a file from an Intranet web site and feed it into a
    > > > program on the PC where the browser is running. Browser is Internet
    > > > Explorer. Both Javascript and VBscript are options.
    > > > Which would be my best options? Examples would be welcomed!
    > > > rj

    >
    > > Maybe this will help (doesn't need browser):

    >
    > >http://groups.google.com/group/microsoft.public.scripting.vbscript/ms...

    >
    > > Once the file is available on the local machine, use the Wscript.Shell
    > > in your script to start the application referencing the local file ...

    >
    > > sDownLoadedFile = "d:\somewhere\filename
    > > with CreateObject("Wscript.Shell")
    > >   .Run "d:\location\your_application.exe " & sDownLoadedFile , 0, True
    > > end

    >
    > > Tom Lavedas
    > > ===========
    > > http://members.cox.net/tglbatch/wsh/


    I didn't understand you original post to mean it was for client side
    script. None of the ActiveX controls invoked in my examples will work
    in client side scripting without significant security intervention/
    risk. In fact, executing an application on a user's machine is
    strictly verboten in an Inter/Intranet environment.

    The only way I know to come close is to get the client to download an
    HTA (Hypertext Application) and then use it to access the file and run
    the application. In its simplest incarnation, an HTA is an HTML with
    its extension changed to .hta. When run by the user on his local
    machine, it can access all of the IE controls, but the security
    environment is far less stringent. It can run ActiveX controls, such
    as the MSXML, ADODB and Wscript Shell.

    Tom Lavedas
    ===========
    http://members.cox.net/tglbatch/wsh/
    Tom Lavedas, Oct 29, 2008
    #6
  7. David Mark Guest

    On Oct 29, 11:44 am, wrote:
    > Thanks David,
    > The idea is that the user only clicks once and generates the whole
    > process. I cannot associate the file type because they are doc files,
    > and they have to be openable by Word in Windows. The idea is to pass
    > them through another application. My main problem is downloading the
    > file to a special directory (temp directory) without the user having
    > to select it.


    The browser does that for you. Give the ones on the server a
    different extension. Your client side program can rename them to
    DOC's when it is done processing them. Then the users can open them
    in Word.
    David Mark, Oct 29, 2008
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pavils Jurjans

    Protect bin folder from direct download

    Pavils Jurjans, Apr 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,610
    George Ter-Saakov
    Apr 29, 2004
  2. Ryan Taylor
    Replies:
    2
    Views:
    922
    Ryan Taylor
    Nov 10, 2004
  3. Luis Esteban Valencia

    Is there a direct download for visual web developer 2005?

    Luis Esteban Valencia, Nov 11, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    610
    Shiva
    Nov 11, 2004
  4. Sam --
    Replies:
    2
    Views:
    594
    Sam --
    Mar 17, 2005
  5. Brett  Kelly
    Replies:
    1
    Views:
    666
    Steve C. Orr [MVP, MCSD]
    Jun 16, 2006
Loading...

Share This Page