Results 1 to 2 of 2

Thread: Download file using javascript

  1. #1
    Join Date
    Sep 2011

    Download file using javascript

    I need to download a file from an html page inside a public portal. File is in an intranet server folder.

    From the html page, using javascript I call an asp.net webservice that reads a file, and sends its content as a byte array.

    How can I download/show that file using that byte array from the javascript function?

    Thanks, Fabio

  2. #2
    Join Date
    Jul 2008
    urbana, il
    just load the binary from ajax, you don't need a byte array...
    to download, the best way is to echo the data from a server that sets a content-disposition header to attachment and offers a meaningful filename to the user.

    without a server, you can use data: urls and an external-handled or unknown mime type to raise the open/save dialog box. this will allow the user to save the file in ie9+, but you won't have a suggested filename, which makes it less usable than the server bounce method...
    Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles