How to track CSV downloads with Angular/Node js?
I am downloading a CSV file(from Node) using Content-Disposition=attachment. My download should always initiate from server side (I don't want to do the download using anchor tags since the data can be quite large and cause memory issues).
But, what are the possible ways of tracking the download and to know when the download is over?
Here are the steps I have followed for tracking the download :
Submitting a form with required parameters.
In my server(node js), getting the parameters and using them to fetch data from external service.
formatting the data and starting the download by using streaming(Content-Disposition is set to attachment and Content-Type is set to application/download).
I tried setting a cookie from server when the download starts and in the client side I am checking for the cookie in regular time intervals to track the download progress.
But, the problem with tracking downloads with Cookie is that : if the users have disabled Cookie in their browser, then download tracking will not work.
Related
Currently trying to allow users to click a button in a react application to open a .docx document in their local version of word.
Have a C# rest endpoint setup that will return a document as a FileStreamResult if you pass it a document id.
Wondering if anyone has accomplished this before as I was eventually hoping that i could pass an endpoint in to the save parameter so once saved it would upload back to the server.
Tried running the ms-word command however it comes up with "this action couldn't be performed because office doesn't recognize the command it was given". ms-word:ofe|u|<>
Thanks in advance.
How to upload image using object function?
When I upload image with some form elements it gives internal error 500. If I remove file element from form then the data is saved with no error.
This has nothing to do with AngularJS. It is your server failing to be able to process the file in the Request. For example, most common cause is the folder the server tries to put the image in not accessible because of security settings in the web-server.
AngularJS is not raising a 500 error, it has to be Web Server raising that error
Check the logs that the your web-server may have.
I have created a single page app using AngularJS and ASP.NET MVC 3. When deploying a new version of the application, it's possible for users to be already logged in as the application is being updated. If these users don't either refresh their browser or log out and back in again to get the new JavaScript files, they will encounter lots of errors and could potentially create invalid data.
Question: in a single page app, is there an elegant way to either prompt users to either refresh their browser or log out and back in again?
I suppose this would be possible through Web Sockets / SignalR, but are there other options?
One generic way I could see is to have your angular app send a client-version # with any http request, and your .NET side watch for that number and when it's out of date ( a newer version has been deployed ) send an error response which you would capture in your angular app. You could then just trigger a refresh or prompt the user to refresh and get the latest version.
What design is used to store file objects that gets loaded from a website. For instance if I have a website that accepts documents or images. So
Use Case 1.
Users logs in and selects a MS word file on his machine and uploads to the website.
Use Case 2.
User logs in and selects a image on his machine and uploads to the website.
How do I store these file objects in the database
The first step is just getting the file from the AngularJS application to the server. This page talks about sending request to the server from the client and should get you started.
Once you have done that, (assuming you are using PHP) you will need to save the resulting file to the database. This post will get you started with saving files to PostgreSQL, but the details will end up being very specific to your situation:
If you have more questions after reading through those resources please add specific details about your setup to your question.
I'm working on a side project right now for an email client. I'm using a library to handle the retrieval of the messages from the server. However, I have a question on caching.
I don't want to fetch the entire list of headers everytime I load the client. Ideally, what I'd like to do is cache them and then update the list with what is on the server.
What's the best way to go about this? Should I store all the header information (including the server's message ID #) in a database, load the headers from that DB. Then as a background task sync up with the server...
Or is there a better way?
Look at the webmail sample of this open source project that use local caching:
http://mailsystem.codeplex.com/
If I remember well, he used a combination of local RFC822 plain text email storing with the message id as the filename and an index file with high level data.
Maybe the message itself where zipped to save disc space.
That's just a sample for the library, so don't expect code art there, but that's a start.