FilePost provides web based file transfer service. You can send large files (up to 3GB) for free.
I have a jquery-based single-page webapp. It communicates with a RESTful web service via AJAX calls.
I'm trying to accomplish the following:
I have 1 & 2 working now, and the client jquery app displays the returned data in the web page by creating DOM elements based on the JSON data. I also have #3 working from the web-service point of view, meaning it will create and return a binary file if given the correct JSON parameters. But I'm unsure the best way to deal with #3 in the client javascript code.
Is it possible to get a downloadable file back from an ajax call like this? How do I get the browser to download and save the file?
The server responds with the following headers:
Download game slenderman for android. Another idea is to generate the PDF and store it on the server and return JSON that includes a URL to the file. Then, issue another call in the ajax success handler to do something like the following:
But doing that means I would need to make more than one call to the server, and my server would need to build downloadable files, store them somewhere, then periodically clean up that storage area.
There must be a simpler way to accomplish this. Ideas?
EDIT: After reviewing the docs for $.ajax, I see that the response dataType can only be one of
xml, html, script, json, jsonp, text , so I'm guessing there is no way to directly download a file using an ajax request, unless I embed the binary file in using Data URI scheme as suggested in the @VinayC answer (which is not something I want to do).
So I guess my options are:
The more I think about it, the more I like the last option. This way I can get information back about the request (time to generate, size of file, error messages, etc.) and I can act on that information before starting the download. The downside is extra file management on the server.
Any other ways to accomplish this? Any pros/cons to these methods I should be aware of?
TaurenTauren
12 Answers
letronje's solution only works for very simple pages.
document.body.innerHTML += takes the HTML text of the body, appends the iframe HTML, and sets the innerHTML of the page to that string. This will wipe out any event bindings your page has, amongst other things. Create an element and use appendChild instead.
Or using jQuery
What this actually does: perform a post to /create_binary_file.php with the data in the variable postData; if that post completes successfully, add a new iframe to the body of the page. The assumption is that the response from /create_binary_file.php will include a value 'url', which is the URL that the generated PDF/XLS/etc file can be downloaded from. Adding an iframe to the page that references that URL will result in the browser promoting the user to download the file, assuming that the web server has the appropriate mime type configuration.
SamStephensSamStephens
I've been playing around with another option that uses blobs. I've managed to get it to download text documents, and I've downloaded PDF's (However they are corrupted).
Using the blob API you will be able to do the following:
This is IE 10+, Chrome 8+, FF 4+. See https://developer.mozilla.org/en-US/docs/Web/API/URL.createObjectURL Download game pokemon rpg for pc.
It will only download the file in Chrome, Firefox and Opera. This uses a download attribute on the anchor tag to force the browser to download it.
JoshBerkeJoshBerke
I know this kind of old, but I think I have come up with a more elegant solution. I had the exact same problem. The issue I was having with the solutions suggested were that they all required the file being saved on the server, but I did not want to save the files on the server, because it introduced other problems (security: the file could then be accessed by non-authenticated users, cleanup: how and when do you get rid of the files). And like you, my data was complex, nested JSON objects that would be hard to put into a form.
What I did was create two server functions. The first validated the data. If there was an error, it would be returned. If it was not an error, I returned all of the parameters serialized/encoded as a base64 string. Then, on the client, I have a form that has only one hidden input and posts to a second server function. I set the hidden input to the base64 string and submit the format. The second server function decodes/deserializes the parameters and generates the file. The form could submit to a new window or an iframe on the page and the file will open up.
There's a little bit more work involved, and perhaps a little bit more processing, but overall, I felt much better with this solution.
Code is in C#/MVC
on the client
amerskamersk
There is a simplier way, create a form and post it, this runs the risk of resetting the page if the return mime type is something that a browser would open, but for csv and such it's perfect
Example requires underscore and jquery
For things like html, text and such, make sure the mimetype is some thing like application/octet-stream
php code
aqmaqm
In short, there is no simpler way. You need to make another server request to show PDF file. Al though, there are few alternatives but they are not perfect and won't work on all browsers:
VinayCVinayC
It is been a while since this question was asked but I had the same challenge and want to share my solution. It uses elements from the other answers but I wasn't able to find it in its entirety. It doesn't use a form or an iframe but it does require a post/get request pair. Instead of saving the file between the requests, it saves the post data. It seems to be both simple and effective.
clientserver
Frank RemFrank Rem
James McGuiganJames McGuigan
Not entirely an answer to the original post, but a quick and dirty solution for posting a json-object to the server and dynamically generating a download.
Client side jQuery:
.and then decoding the json-string at the serverside and setting headers for download (PHP example):
ralftarralftar
I think the best approach is to use a combination, Your second approach seems to be an elegant solution where browsers are involved.
So depending on the how the call is made. (whether its a browser or a web service call) you can use a combination of the two, with sending a URL to the browser and sending raw data to any other web service client.
naikusnaikus
I have been awake for two days now trying to figure out how to download a file using jquery with ajax call. All the support i got could not help my situation until i try this.
Client Side
Server Side
Good luck.
How To Download From Filepost Windows 10
Otis-iDevOtis-iDev
How To Download From Filepost To Pc
With HTML5, you can just create an anchor and click on it. There is no need to add it to the document as a child.
All done.
If you want to have a special name for the download, just pass it in the
download attribute:
rewrittenrewritten
Another approach instead of saving the file on the server and retrieving it, is to use .NET 4.0+ ObjectCache with a short expiration until the second Action (at which time it can be definitively dumped). The reason that I want to use JQuery Ajax to do the call, is that it is asynchronous. Building my dynamic PDF file takes quite a bit of time, and I display a busy spinner dialog during that time (it also allows other work to be done). The approach of using the data returned in the 'success:' to create a Blob does not work reliably. It depends on the content of the PDF file. It is easily corrupted by data in the response, if it is not completely textual which is all that Ajax can handle.
Wray SmallwoodWray Smallwood
Not the answer you're looking for? Browse other questions tagged javascriptjqueryajaxrest or ask your own question.Sample Results From Member DownloadsHow To Download From Filepost To Watch
Zedload.com provides 24/7 fast download access to the most recent releases. We currently have 287,973 full downloads including categories such as: software, movies, games, tv, adult movies, music, ebooks, apps and much more. Our members download database is updated on a daily basis.
Take advantage of our limited time offer and gain access to unlimited downloads for FREE! That's how much we trust our unbeatable service. This special offer gives you full member access to our downloads. Click to the Zedload tour today for more information and further details to see what we have to offer.
Download Search Tips
How To Download From Filepost To Computer
To improve search results for Filepost try to exclude using words such as: serial, code, keygen, hacked, patch, warez, etc. Simplifying your search query should return more download results.
Many downloads like Filepost may also include a crack, serial number, unlock code or keygen (key generator). If this is the case then it is usually made available in the full download archive itself.
Copy & Paste Links
Crack in this context means the action of removing the copy protection from software or to unlock features from a demo or time-limited trial. There are crack groups who work hard in order to unlock software, games, etc. If you search for Filepost Crack, you will often see the word 'crack' amongst the results which means it allows you to unlock the full version of the software product.
What is a Serial?
How To Download From File Post
Serial means a unique number or code which identifies the license of the software as being valid. All retail software uses a serial number or key of some form. A serial number can also be referred to as an Activation Code or CD Key. When you search for Filepost Serial, you may sometimes find the word 'serial' in the results. This usually means your software download has a serial number.
What is a Keygen?
Keygen is short for Key Generator. It means a small program that can generate an activation code, serial number, license code or registration number for a piece of software. A keygen is made available by crack groups free to download. If you search a site for Filepost Keygen, you may see the word 'keygen' in the results which usually means your download includes a keygen.
How To Download From Filepost To English
Popular Searches
Filepost | Gene Simmons Family Jewels | Hailey Young And Buck | PDFill 8.0 Registration Code | Shri Jyoti Star V5.42 Build 850 By Tsrh | Alchemy Mindworks Presentation Wizard V2.0a53 Crd | Canon F151300 Driver Free | Junkenew 9.0 | Whorefights Net Clone | Sony Cinescore 1.0c | Dota Allstars 6.48 Al | Gene Mapper Id Vertion 3.2 | Dupe Eliminator 11.1 | Nationa Treasure | Block Breaker Deluxe Retail Java Se T630 Cz By Rlyeh | The Mind |
How To Download From Filepost Laptop
[ Home | Signup | Take A Tour | FAQ | Testimonials | Support | Terms & Conditions | Legal & Content Removal ]
Design and Layout © 2019 Zedload. All rights reserved. Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |