I have designed a download button in frontend where seller can download invoice but i want to restrict him to download the file only once.How can I that?


This seems more like a general architecture question, but here is how I would handle this: I'd create a database table containing the customer ID, invoice ID, and download count. When the customer downloads the invoice, I would increment the download count by one. Before rendering the download button, I would get the download count and check if it is greater than the maximum and if so the button would not be rendered at all. Note that this depends on the invoice download being generated on the fly.

  • Thankyou for the answer!!!! – user49931 Apr 21 '17 at 12:36

Add new attribute to Invoice (downloaded - yes/no) then when user hits download update it.

  • Okay!!!!! I will try this Thankyou!!! – user49931 Apr 21 '17 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.