Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

152
Vistas
How to specify the filename during download over HTTP

I currently store my woocommerce product files on S3 in the following format:

/bucket/{product_id}.zip

When a customer clicks the download link in their customer dashboard the element is as follows:

<a href="https://url/1234.zip">Download Product Name</a>

This downloads the file into their downloads folder as 1234.zip

I would like to be able to pass some values to the request so that the filename can be downloaded as {param1}-{param2}.zip

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Like this:

<a href="https://url/1234.zip" download=`${param1}-${param2}.zip`>Download Product Name</a>

Refer: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download

Note:

download only works for same-origin URLs, or the blob: and data: schemes. How browsers treat downloads varies by browser, user settings, and other factors. The user may be prompted before a download starts, or the file may be saved automatically, or it may open automatically, either in an external application or in the browser itself. If the Content-Disposition header has different information from the download attribute, resulting behavior may differ: If the header specifies a filename, it takes priority over a filename specified in the download attribute. If the header specifies a disposition of inline, Chrome and Firefox prioritize the attribute and treat it as a download. Old Firefox versions (before 82) prioritize the header and will display the content inline.

about 4 years ago · Santiago Trujillo Denunciar

0

When they click a button to download the file, you can add the HTML5 attribute "download" where you can set the default filename.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download

<a href="https://url/1234.zip" download={${param1}-${param2}.zip}>Download Product Name

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda