Fork me on GitHub

jQuery File Download v1.4.0 released with promise support 93

by

I’ve been neglecting jquery.fileDownload.js a little bit while working on my Durandal.js and FluentKnockoutHelpers demo but since that’s mostly wrapped up I have merged some pulls and added promise support to jQuery File Download. Promises make using the plugin a whole lot cleaner. If you haven’t used them yet start to they are awesome! Enjoy!

As usual the source can be obtained here:

https://github.com/johnculviner/jquery.fileDownload

A short example of what you can now do:

 

93 thoughts on “jQuery File Download v1.4.0 released with promise support

  1. Reply wambacher Oct 13, 2016 3:51 pm

    So many questions – and NO ANSWERS

    i think i have to get rid of this unsupported stuff :(

  2. Reply Sana I Aug 26, 2016 5:38 pm

    Hi,
    Love this plugin, but having an issue with getting the error in the failCallback. Error comes as undefined when I use this in my code:

    failCallback: function (responseHtml, url, error) {
    console.log(error);
    }

    I think it’s because the plugin code isn’t passing back the error:

    internalCallbacks.onFail(formDoc.body.innerHTML, fileUrl);

    Is there any way to get the error passed back in this case in the fail callback, so it can be handled appropriately?

  3. Reply 【送料無料】会津漆器 スリムくりぬき弁当箱 布袋一段 001-792(木製、くり抜き、お弁当箱、仕切付、ランチボックス、男子、女子、メンズ、レディース、子供、キッズ)【あす楽対応 Mar 15, 2016 7:18 am

    Terrific work! That is the kind of information that should be shared around the net. Shame on the seek engines for now not positioning this submit higher! Come on over and talk over with my site . Thanks =)

  4. Reply 【激安市場】★今夜20時~4H限定P10倍★【送料無料/即納】プレミアム 密度50D 8cm Nov 18, 2015 3:13 pm

    私はyouveはいくつかの本当に面白いポイントを作成したと思います。あまりにも多くの人々は、実際にはこのことについて、あなただけやったように考えるだろう。イムtheresのように大きく、このトピックのthatsについては明らかにされて、あなたはそんなにクラスで、とてもよくそれをやったことが純粋に感動。 1あなたは非常に良い、男!右ここに純粋に素晴らしいもの。あなたはそこに非常に多くの肯定的な点を持って

  5. Reply 机 つくえ 幅115cm×奥行45cm デスク オフィスデスク ワークデスク ガラスデスク Nov 5, 2015 7:23 am

    男はスパムここで私が非常識なドライブします!それらをDelte!私が持っていた

  6. Reply P01 x master-piece(プレイ x マスターピース )PLAYMASTER CLUB ナイロンショルダーバッグ日本製 Nov 1, 2015 4:29 am

    ソースは、私にとって非常に有用である可能性があります!私は私のブログにこのWebページへのリンクを送信します。私は私の訪問者はそれが非常に便利な発見します正います。

  7. Reply グレコ トレッコ 【レインカバー、フットマフ付】 (ジェラルド)+ロジコS HP& Oct 11, 2015 9:24 am

    ポストをありがとうございましたあなたのサイトと私は話題に興味を持つようになりました。私はあなたのコンテンツが好きで、私は私が私の仕事であなたの言葉を使うことができるかどうかを考えていますか?それはそうなのでしょうか?はい場合は、私と連絡してください。ありがとうございます。すべての

  8. Reply 男女兼用 バッグ リュック デイパック バックパック Laosmiddle ラオスミドル BACKPACK 00067 Oct 2, 2015 10:15 am

    アン魅力議論はコメントする価値があります。 I 思う するべきこの上の書き込みはるかより トピック、それかもしれないタブーではないトピックが、典型的 男性と女性このようなトピックについて話すのに十分ではありません。次へ| に向けへ。あなたのブログ、あなたがここに投稿のすべてを取得するが、私はコメントしたことがないが、私はこの記事を見たとき、今日は、私はコメントから自分自身を止めることができなかった私は常にへの訪問を支払う訪問

  9. Reply 【送料無料】 エムケー精工(MK精工) 分別式ダストボックス クリーンペール Oct 1, 2015 11:36 am

    。 話すトークについて、私はそれを読むために私の選択だったけど、私はちょうどヤウドはに興味深い何かを持っていると思った、さあ、男。私が聞くすべてはあなたがしようとして忙しすぎしゃべれなかったときに修正注意を| あなたはできますが、可能性何かについて泣き言のカップル実際に実際にあります。

  10. Reply NECLEDペンダントライト(~8畳) HCDB0811-X 調光(昼光色) (HCDB0811X):ソフマップ楽天市 Oct 1, 2015 11:35 am

    書かあなたが持っている。アシスト私良い取引、私は検索しただけで何のために:有益と{優れた|優れたD.の

  11. Reply 【75%OFF】スーツケースと同時購入特価 スーツケースベルト キャリーケー Sep 15, 2015 11:36 pm

    ポイント あなたはよだけの努力のためにAを受け取ります。 場所を正確にあなた真だった私たちを混乱事実あなたの内側。 正確ここであなたが..詳細は作るか、または引数を破る、彼らが言うには、知っていて、それがすることができませんでした。 成果結果私がお届けしましたまさにまさにあなたに明らかにしてみましょう、と述べました。書き込みはかなり説得力のあることができ、それはおそらく、私はの理由でコ​​メントする努力を取ります。それを| 実行やっ私はそれを定期的に習慣にしていません。 コンセプトアイデアではない、あなたを接続するように見えるどれだけの確信 | 私は私が第二に、私は簡単に、あなたが作るロジックでジャンプを気づくことができるが、それは、実際の結論を生成します。今私は自分の位置をサブスクライブしますそうであっても願い の将来の近くあなた実際にはあなたのドットを接続かなり ずっと良い大きいです。

  12. Reply kumaresan Aug 6, 2015 11:55 pm

    Hai,

    I want to try download image file nothing working reply!!!..

    $.fileDownload(“images/images.jpg”)
    .done(function () { alert(‘File download a success!’); })
    .fail(function () { alert(‘File download failed!’); });

    • Reply kumaresan Aug 7, 2015 1:13 am

      image download not working.,..

      $(document).on(“click”, “a.fileDownloadLink”, function () {
      $.fileDownload(“../images/images.jpg”)
      .done(function () { alert(‘File download a success!’); })
      .fail(function () { alert(‘File download failed!’); });
      });

  13. Reply Hai Nguyen Jun 29, 2015 5:04 am

    Hi John!

    I’m trying to use your plugin for download dynamically generated file from server!
    But my server require custom request header token to accept request!
    So I must do it how ?

    Thanks for reply and have a nice day…

  14. Reply Devlinux2 May 23, 2015 5:19 pm

    Hello John.
    Congratulations for their work!

    I’d like sugest that on the callback functions
    accept as JSON response from back-end.

    Example: .done(function (resultParam){}

    Or

    let the developer choose

    Example: .done(function (resultParam){
    //code to part to html here.
    //code to part to json here.
    }

    Some times the server need to send errors messages to client (a real error message not a generic error message).

  15. Reply vishal Mar 28, 2015 2:42 am

    This is my javascript code
    to generate pdf using php dompdf
    I want to download the file after creation / on success of ajax
    I have written following code
    //code—-
    $(“#ExportToPdf”).click(function(){

    // alert($(“#hidden_content”).html());
    var pdfData = $(“#hidden_content”).html();
    var billNo = $(“#hidden_content #billNO”).val();
    //alert(pdfData);
    var billDate = $(“#hidden_content #billdate”).val();
    // alert(billNo+””+billDate);
    bill_name = billNo+”_”+billDate;
    console.log(bill_name);
    $.ajax({
    type:”POST”,
    url:”php/PdfGenerate.php”,
    data:”&data=”+pdfData+”&bill_name=”+bill_name,
    success:function(data){
    console.log(‘”pdf\/bill_’+bill_name+’.pdf”‘);
    var path = “pdf/bill_2_2015-03-26.pdf”;
    //console.log($.fileDownload(“pdf/bill_”+bill_name+”.pdf”));
    $.fileDownload(path,{
    contentType: “application/pdf”
    })
    .done(function () { alert(‘File download a success!’); })
    .fail(function () { alert(‘File download failed!’); });
    console.log(“pdf has been genrated “);
    // console.log(data);
    },
    error:function(){
    alert(‘error’);
    }

    });

    });

    file fail to download and show following error on console

    Resource interpreted as Document but transferred with MIME type application/pdf: “http://localhost/pathology_app/pdf/bill_2_2015-03-26.pdf”.

    please give solution as early as possible
    Thanking U!!!

    • Reply Bilal Ahmed Yaseen Jan 5, 2016 6:40 am

      Vishal,

      I am also getting the same error. Did you find any solution for this? Thanks

    • Reply Sana I Aug 26, 2016 5:37 pm

      Hi,
      Love this plugin, but having an issue with getting the error in the failCallback. Error comes as undefined when I use this in my code:

      failCallback: function (responseHtml, url, error) {
      console.log(error);
      }

      I think it’s because the plugin code isn’t passing back the error:

      internalCallbacks.onFail(formDoc.body.innerHTML, fileUrl);

      Is there any way to get the error passed back in this case in the fail callback, so it can be handled appropriately?

  16. Reply domain Mar 11, 2015 1:49 am

    Hi, I want to subscribe for this weblog to get most up-to-date updates, therefore where can i do it please help out.

  17. Reply Joe Kahl Mar 10, 2015 4:12 pm

    John,

    I need to send back up to a few hundred pairs of field values from a user selection.
    The limitation of going through $.param() is killing me.
    Due to $.param() my model has to be AccountId and DocumentURL, over and over again.
    Even when I get code like this:


    var request =
    [
    {
    name: "EncryptedAccountId",
    value: URLencode("ZuFr1inhsT2gwV8tcYu4dQ==")
    },
    {
    name: "EncryptedUrl",
    value: URLencode("fLFA1GLvRljxk91O4tDnZvoJFt4MClhQZl5SVhC9IeTwUXP8P6yZMGS9UIz9PneoGasaENGFHA3D+Xu7xy0SUoCm8a9LNS9GVbRO246vZEfZf+MyIKwghiZsWDwm1LSQpbO8c8b78gFZkjfYsAKTXgh2eFfP+xqrmmgE8J3AsNjC8WzhwfQyZyttBNuCfMQB4PB+whmLy7nCvrOzVa7q7htCqCFVddPLj2rdsGnvlxqhPuzEX/y6XGpwFaomLfOg+2eQXvKJcn6GS33B9BXObgk8YLmDnjKPWEn3Wgneygeef5YhWNlueMXZyFxsXXvmoMFfLXGLuHU=")
    },
    {
    name: "EncryptedAccountId",
    value: URLencode("ZuFr1inhsT2gwV8tcYu4dQ==")
    },
    {
    name: "EncryptedUrl",
    value: URLencode("fLFA1GLvRljxk91O4tDnZvoJFt4MClhQZl5SVhC9IeTwUXP8P6yZMGS9UIz9PneoGasaENGFHA3D+Xu7xy0SUoCm8a9LNS9GVbRO246vZEfZf+MyIKwghiZsWDwm1LSQpbO8c8b78gFZkjfYsAKTXgh2eFfP+xqrmmgE8J3AsNjC8WzhwfQyZyttBNuCfMQB4PB+whmLy7nCvrOzVa7q7htCqCFVddPLj2rdsGnvlxqhPuzEX/y6XGpwFaomLfOg+2eQXvKJcn6GS33B9BXObgk8YLmDnjKPWEn3Wgneygeef5YhWNlueMXZyFxsXXvmoMFfLXGLuHU=")
    },
    {
    name: "EncryptedAccountId",
    value: URLencode("ZuFr1inhsT2gwV8tcYu4dQ==")
    },
    {
    name: "EncryptedUrl",
    value: URLencode("fLFA1GLvRljxk91O4tDnZvoJFt4MClhQZl5SVhC9IeTwUXP8P6yZMGS9UIz9PneoGasaENGFHA3D+Xu7xy0SUoCm8a9LNS9GVbRO246vZEfZf+MyIKwghiZsWDwm1LSQpbO8c8b78gFZkjfYsAKTXgh2eFfP+xqrmmgE8J3AsNjC8WzhwfQyZyttBNuCfMQB4PB+whmLy7nCvrOzVa7q7htCqCFVddPLj2rdsGnvlxqhPuzEX/y6XGpwFaomLfOg+2eQXvKJcn6GS33B9BXObgk8YLmDnjKPWEn3Wgneygeef5YhWNlueMXZyFxsXXvmoMFfLXGLuHU=")
    }
    ];

    The MVC controller action gets the wrong data submitted.
    I am seeing data like the name of the controller and the name of the action and an null Id coming back.
    I check the network traffic and the expected results are in the Form Data.

    It seems like web technology itself is so disappointing.
    I tried using AJAX. AJAX sends complex JSON data perfectly. But AJAX always wants a response and since my use case is to open up a document the AJAX cannot be used because the byte stream goes to AJAX instead of the browser.

    So I tried the fileDownload but I cannot get the user selected data passed back to the controller. Nothing but heart ache!
    Can you provide any guidance or suggestions or a demo of sending several pairs of values to the server through the fileDownload to a controller action? I use ASP.NET MVC 4.


    [HttpPost]
    public FileResult MergeDocuments(Dictionary mergeRequest)

    Thanks, Joe

    • Reply John Culviner Mar 11, 2015 6:45 pm

      Hey Joe,

      Yeah you can’t use “real” AJAX. Not sure, it would be into the specifics of how the model binder is working which I haven’t looked at in a loooong time :)

      John

  18. Reply Ewert Bergh Feb 11, 2015 5:10 am

    Hi John

    Great work on this it works really well, thanks!

    Kind regards

  19. Reply zhilevan Dec 27, 2014 7:21 am

    I want to try download image file,I try absolute and relative path in my site, but nothing worked

    $.fileDownload('http://www.mysite.com/sites/default/files/toy_images/jpeg/toy-image-1419684403_3170.jpeg')
    .done(function () { alert('File download a success!'); })
    .fail(function () { alert('File download failed!'); });

    or

    $.fileDownload('/sites/default/files/toy_images/jpeg/toy-image-1419684403_3170.jpeg')
    .done(function () { alert('File download a success!'); })
    .fail(function () { alert('File download failed!'); });

    both of them return FAIL to me,where is the problem?

  20. Reply Rosetta Sep 4, 2014 8:39 pm

    Its like you read my mind! Yoou seem to know sso much about this, like you wrote the book inn it or something.
    I think that you can do with a few pics to drive the messge home a litte bit,
    but other than that, this is excellent blog. An excellent read.
    I’ll certainly be back.

  21. Reply Mickael Outhier Jul 11, 2014 8:18 am

    Hello John,

    First I would like to thank you for the very nice job that you done.
    This plugin is the very best extension that I can found for make my application.

    I’ve just a problem with the “done” callback : it’s don’t work.
    The file is well downloaded but the callback is not taken into consideration.

    The “fail” callback is working good.

    That’s my code :

    $.fileDownload(url).done(function () { alert('File download a success!'); });

    I’ve this problem with at least 2 browser : firefox and chrome.

    My application really need this callback… do you know how i can solve my problem ??

    Many thankz for your help !!

    Mickael

  22. Reply Sree Jun 23, 2014 8:00 am

    Is it possible to pass headers in jquery Plugin

  23. Reply Andrea Palmatè Jun 5, 2014 6:05 am

    For those want to use a “JSON” powered file downloader (for example to call a WebMethod on .NET) i’ve changed the file a little bit:

    http://www.papersoft.it/jquery-download-con-parametri-json/

    Direct JS link: http://www.papersoft.it/wp-content/misc/jQuery.fileDownload.js

    I’m sure my changes can be refactored.. but i have no time at moment..
    To use json parameters you can use a call like

    $.fileDownload("", {
    httpMethod: "POST",
    data: dataToSendExport,
    contentType: "application/json"
    })
    .fail(function () { alert("Error during export") });

    where dataToSendExport is an array of objects built like:


    dataToSendExport[0] = { "tableName": tableName };
    dataToSendExport[1] = { "columns": replaceAll("\'", "\\'", JSON.stringify(columns)) };

    Hope you find it useful

  24. Reply Michael May 30, 2014 5:28 pm

    Its a great plugin and I have easily implemented the success scenario.
    But am not able to handle the failure scenario.
    In the event of failure, I m setting the cookie as “fileDownload=true; expiry=” on the server, but failCallback is not being invoked.

    Is this enough or should I do something else? I m using java for server programming.

    Would be very glad on your response.

  25. Reply Alvaro May 8, 2014 10:31 am

    Hello, Nice feature!

    The callback functions (either using “.done()” or “successCallback” ) in my case never get executed.
    I just return a Content-type: application/vnd.ms-excel and Content-Disposition: attachment response and i have this js code:
    $.fileDownload(url)
    .done(function () { alert(‘success test’); })
    .fail(function () { alert(‘fail test’); });
    What am i missing?
    Thanks.

  26. Reply Gupta May 7, 2014 10:24 am

    Hi,

    I want to get the size of the file before the file gets downloaded. Is it possible?

    Thanks in Advance,
    Gupta.

    • Reply Jeneva Aug 10, 2016 3:13 am

      Spectrum Sinclair, Atari, commodore 64, Mega drive, Game gear, Lynx, neo geo, Saga Saturn, all I can think of for now, may think of more later- if I do I will edit the poee.Reftrencss : Was this answer helpful?

    • Reply http://www./ Oct 23, 2016 11:11 am

      I've been reading your blog for a while and love all your fashion and beauty advice! (In particular, the Benefit eye bright pencil :) Thanks! Regarding the stupid anons who keep posting lame comments, they act like you're the first one to blog about F&B material. Whatevs. They need to get a life.

    • Reply http://www./ Oct 24, 2016 5:00 am

      Queelis Tikrai, pirma dalis buvo tokia monotoniÅ¡ka, kad tik iÅ¡ principo pabaigiau. Jau nekalbant apie grafikÄ… – spalvų turÄ—jo tik pilkos ir rudos, regis, baisu.Antra ir gražiau atrodo, ir įdomesnių misijų buvo.Brotherhood kol kas gana panaÅ¡u į antrÄ…, bet irgi gana neblogai.AÅ¡ pats antrÄ… ir trečiÄ… dalis panaÅ¡iai (gerai) vertinčiau.

    • Reply formula para calcular cuota de prestamo Oct 25, 2016 3:33 pm

      This is really an extremely amazing effective source you are providing and you simply provide this apart cost-free!! We that may match up discovering web sites which understand the specific valuation on supplying a person using a exceptional understanding useful resource for no price. We really dearly adored analyzing this web site. Have fun here!

    • Reply http://www./ Nov 4, 2016 3:37 pm

      Arif,In the days of the Holy Prophet (SAWA), you did not have so many different interpretations floating around.However, now to sort the wheat from the chaff, you need an exegesis from an accomplished scholar. The apparent meaning of the Quran is not difficult to understand, but for in depth understanding, you need to read deeply too.Surah Fatiha, which has just seven verses, needs several pages to describe.The verse of the lamp forms the subject matter of an entire book.

    • Reply rti.org.tw Nov 7, 2016 6:42 pm

      Undeniably believe that which you stated. Your favorite reason seemed to be on the net the easiest thing to be aware of. I say to you, I definitely get irked while people think about worries that they just don’t know about. You managed to hit the nail upon the top and also defined out the whole thing without having side-effects , people could take a signal. Will probably be back to get more. Thanks

    • Reply http://www./ Nov 13, 2016 10:00 am

      No sliding fees? I worked for twelve thousand dollars a year as a counselor for two years after I had my Masters. You want money, then go get it. Go0d for you. We all make choices.

  27. Reply priyank May 6, 2014 4:39 pm

    i am not able to implement this plugin in my mvc4 website.
    i want to display waiting dialog box.
    can any one tell me exact steps for this process??
    please??

  28. Reply Michael May 1, 2014 6:07 pm

    Hi, great plugin!

    Success is working fine, but my fail callback never gets called even though my server response looks the same as on the demo page for failures — except my Content-Type is “text/xml” instead of your “text/html”. Is that it?

    $.fileDownload(url, {httpMethod:’POST’, data: {“from”:”jquery.fileDownload”}})
    .done(function (url) { $.bootstrapGrowl($(event.target).text() + ” – download successful! “, {“ele”: event.target, “type”:”success”, “width”: “auto”}); })
    .fail(function (responseHtml, url) { $.bootstrapGrowl(responseHtml + $(event.target).text() + ” – download failed! “, {“type”:”error”, “width”: “auto”}); });

    Thanks!

    • Reply Michael May 1, 2014 6:42 pm

      I changed the response to use Content-Type “xml/html” and the fail callback works. Should have tried that first (arg is “responseHtml” after all) :)

  29. Reply Jim Apr 30, 2014 10:16 am

    So, I’m researching using your code to invoke a POST of a JSON body to my internal server to push a file to my end user. The problem is, like Sebastian, who I think is trying to do the same thing or similar, that your code doesn’t have the ability to push a JSON body to the server; and probably rightly so. Looking at your code, it seems that you’re “tricking” the client into creating and submitting either an iframe or a new document window to make the call to the server with the form entities within the respective container.

    I’m researching more to patch your 1.4.2 script to allow such an ability, if possible. I’m just reaching out to see if you could lend some pointers on whether it’s doable or not.

    Thanks!

  30. Reply shishir kamal Apr 23, 2014 1:54 am

    Hi John,
    i am using the plugin and it is working fine for desktop browsers. but on Mobile browsers [Android and Ios] it is making two calls to server to get the response. both the calls are returning with a downloadable PDF document, but the token is getting expired.
    Please let me know if we can restrict it to make only one call from Android and Ios browsers ?

  31. Reply Matthew Jan 29, 2014 8:45 pm

    John,

    I am using your library to download some Excel reports, but am having some issues running a long-polling type of progress check. I set up an interval in the prepareCallback to check a progress URL on the server, but it only runs once and doesn’t return until after the download has completed.

    Any ideas as to why your iFrame form submission would cause other XMLHTTPRequest’s to block?

    Thanks for your help with this.

  32. Reply Saurabh Dec 11, 2013 5:39 pm

    I think , the code should also check for the cookie in the document of iframe. When I wrote cookie, it wrote in the iframe.document instead of current document. I modified the code to do this:
    var cookieDoc = downloadWindow ? downloadWindow.document : getiframeDocument($iframe);
    if (cookieDoc.cookie.indexOf(settings.cookieName + “=” + settings.cookieValue) != -1) {

    //execute specified callback
    internalCallbacks.onSuccess(fileUrl);

    //remove the cookie and iframe
    cookieDoc.cookie = settings.cookieName + “=; expires=” + new Date(1000).toUTCString() + “; path=” + settings.cookiePath;

    cleanUp(false);

    return;
    }

  33. Reply James Nov 14, 2013 1:29 pm

    Hi John,

    Excellent plugin, i’ve got the following code working to download files and it successfully displays error if file not found and displays the please wait while we prepare your file message. However, when the file download begins, the message should disappear like it does on your demo but its not disappearing in my code below. Any ideas what i’m doing wrong?


    $(document).on("click", "a.fileDownloadSimpleRichExperience", function () {
    $.fileDownload($(this).prop('href'), {
    preparingMessageHtml: "We are preparing your report, please wait...",
    failMessageHtml: "There was a problem generating your report, please try again."
    });
    return false; //this is critical to stop the click event which will trigger a normal file download!
    });

    download

    • Reply John Culviner Nov 14, 2013 1:31 pm

      Are you adding a cookie as required?

      • Reply James Nov 14, 2013 1:38 pm

        Thanks for your reply John, didnt see anything about adding a cookie. At what point do I add the cookie? and what cookie? you got any examples?

        • Reply John Culviner Nov 14, 2013 1:47 pm

          I’ve added note of this to the source now too.

          https://github.com/johnculviner/jquery.fileDownload

          also mentions it.

        • Reply Klaus Dec 3, 2013 4:54 am

          I’ve put the line:

          document.cookie = settings.cookieName + “=true; path=” + settings.cookiePath;

          last in the onPrepare-function.

          By that I did not need to have it set by code.


          onPrepare: function (url) {

          //wire up a jquery dialog to display the preparing message if specified
          if (settings.preparingMessageHtml) {

          $preparingDialog = $("").html(settings.preparingMessageHtml).dialog(settings.dialogOptions);

          } else if (settings.prepareCallback) {

          settings.prepareCallback(url);

          }

          // Set the cookie each time the function is prepared // Klaus
          document.cookie = settings.cookieName + "=true; path=" + settings.cookiePath;
          }

  34. Reply yest Nov 6, 2013 8:23 pm

    hey , when i press downlaod when it been succed not working hide the tab, the tab not hidding ! why?

  35. Reply David Oct 24, 2013 2:00 pm

    Hello John,

    I’m getting the following error:

    Resource interpreted as Document but transferred with MIME type image/png

    Same error with all file types. I tried some code modifications on my site but nothing works.

    Can you help me please?

    Kind regards!

    • Reply Cornelia Aug 10, 2016 8:06 am

      This induotrces a pleasingly rational point of view.

    • Reply abtretung lebensversicherung baufinanzierung Nov 5, 2016 1:21 am

      Bare sørg for å sende Emil i en helt annen retning enn hit!! HAtt nok!!Det ble så fint og koselig hos deg:)Vi skulle vært katt eller hund og tatt livet med knusende ro:))Sørg for at du ikke har løse gjenstander utomhus og kos deg inne:)Klem fra meg:)

    • Reply http://www./ Nov 16, 2016 5:07 am

      I love the cooking world, and there are a few combinations I'm constantly drawn to – seafood and garlic, lamb and cumin, green and red… Years in hospitality have left me with a strong appreciation for foodies, chocolatiers, punters and very specific constant chocolate cravings!But the real reason I want to win is because I love eating food. What more is there to say?

    • Reply http://www./ Dec 14, 2016 11:40 pm

      Victor Tribo Naftali / A cada domingo que tem tido o Rally-FJ tem sido mas animado, as tarefas dessa semana foram muito boas, o pessoal usou a critividade e só arrebentou!

    • Reply http://www.kreditanbietervergleich.com/ Feb 12, 2017 10:28 am

      Actually, Bilbo did not complete the contract within a year… he did not complete the task. Some of the treasure that was in the hoard at Erebor when Bilbo began pilfering, was not recovered, despite the fact that Bilbo knows exactly where it lies.

  36. Reply Roman K Oct 11, 2013 10:03 am

    The plugin is great,

    One problem though, if the cookie was not set and you try to download the file, the function checkFileDownloadComplete() { … } will get into the infinite loop and failCallback doesn’t get called. You can replicate it by putting console.log(‘something’) at the beginning of the function. Tested on Chrome and FF.

  37. Reply Gabriel Sep 28, 2013 12:49 am

    Hello
    is there any crossdomain configuration to setup on the server where the files are hosted ? i’m trying your script and it’s working if i set 1 of your example files as target, but i get an “error occured” when trying with a pdf hosted on my server (yes, i double checked the file url to make sure it is the good one).
    any thoughts ?

    thank you for your help

    • Reply John Culviner Oct 11, 2013 10:25 am

      Cross domain doesn’t work unfortunately because of security restrictions placed on cookies and iframes across domains

      • Reply priyank May 6, 2014 4:42 pm

        hey…john
        i am not able to implement this plugin in my mvc4 site. i want to show waiting dialog for my diff excel file’s download period.
        can you tell me exact steps for that??
        please?

  38. Reply Manuel Sep 9, 2013 10:16 am

    I can not make it work in asp.net webforms. Can you upload an example?

  39. Reply enrico Sep 9, 2013 9:49 am

    I have the same problem of Roger.
    File is downloaded but successCallback (.done) does no trigger. any ideas?
    Thanks

  40. Reply Chris Aug 29, 2013 10:34 am

    Gabo I would be interested in a complete copy of your script if you’re still reading this.
    Thanks,
    Chris

  41. Reply John Seguin Jul 30, 2013 2:56 pm

    I am attempting to use your plugin to allow users to download jpeg files. The code works without generating an error, however, it also does NOT initiate the download process. Because the content can be rendered by the browser, it simply is rendered (yet kept invisible) in the iframe.

    I am at a loss with this situation. I’ve been working on this problem for some time. Your assistance is greatly appreciated.

    Thanks,

    – John.

    • Reply Jon Choy Aug 1, 2013 7:40 pm

      Are you setting Content-Disposition: attachment;filename=(file)?
      If so, have you tried also plugging in a bogus MIME type to prevent the browser from realizing it’s an image?

  42. Reply Kellee Jul 17, 2013 5:15 pm

    A person essentially help to make significantly posts I would state.
    This is the first time I frequented your website page and so
    far? I surprised with the analysis you made to make this particular post
    incredible. Fantastic process!

  43. Reply Chris Fletcher Jul 16, 2013 10:20 am

    I would like to suggest that when you hide the iframe in your plugin, instead of doing .hide() or display:none, you should do position:absolute;top:-10000px; or the like. This is because if the iframe has js code that runs when the page loads that tries to manipulate the DOM it will fail if the frame is hidden. BTW, this is the case especially in IE.

  44. Reply Roger Jul 11, 2013 5:14 am

    I have problem.

    I have such code
    $(function()
    {
    $(document).on(“click”, “a.download”, function()
    {
    $.fileDownload($(this).prop(‘href’))
    .done(function() { alert(‘File download a success!’); })
    .fail(function() { alert(‘File download failed!’); });
    return false;
    });

    });

    but File download a success! has neved appeared. File is downloaded but successCallback (.done) does no trigger. any ideas?

  45. Reply Justroy May 23, 2013 2:12 am

    How can I use this on my asp.net webforms project? Can you please post some codes on how to use this in webforms. thanks

  46. Reply Gabo May 20, 2013 4:52 pm

    Hi John,

    This plugin has been very useful for me, I just had an issue trying to send a parameter when the symbol “=” is present in some field value as the value is not been send complete in the request, to solve this, I just replaced the logic to parse the URL attributes to send those as hidden elements in the form for a POST method. This was my change:

    var search = /([^&=]+)=?([^&]*)/g;
    var match = null,
    key = null,
    value = null;

    while (match = search.exec(settings.data)) {
    key = match[1]
    if (key) {
    value = settings.encodeHTMLEntities ? htmlSpecialCharsEntityEncode(decodeURIComponent(match[2])) : decodeURIComponent(match[2]);
    formInnerHtml += "";
    }
    }

    Please, let me know what do you think about it?

    Gabo

  47. Reply Namjith May 15, 2013 11:47 pm

    How we can implement with PHP? Where i need to specify the headers? Please help.

  48. Reply Sebastian May 15, 2013 4:12 pm

    Hi John!
    I’m trying to use your plugin for download dynamically generated pdf from server, but I’m getting error: “Uncaught TypeError: Cannot read property ‘undefined’ of undefined”. Code snippet: $.fileDownload('Trips/AsyncPrint', {
    successCallback: function (url) {
    alert('done!');
    },
    failCallback: function (responseHtml, url) {
    alert('fail.');
    },
    httpMethod: "POST",
    data: JSON.stringify(d)
    });

    What’s wrong? Thanks for reply and have a nice day… :)

Leave a Reply