I am getting the userid from here
String struserid = tempdb.getuserid();
This is how I am setting content disposition header.
response.setHeader("Content-Disposition", "attachment; filename=sample.pdf");
This will prompt to download an attachment with filename as 'sample.pdf'. But I need the filename like '123456_sample.pdf'
Note: 123456 is the value that I got from db and it is stored as string struserid
Just concatenate the strings:
response.setHeader("Content-Disposition", "attachment; filename=" + struserid + "_sample.pdf");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With