| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/es/docs/Web/HTTP/Reference/Headers/Content-Disposition | [Back] [Original] |
Get to know MDN better
Esta pgina ha sido traducida del ingls por la comunidad. Aprende ms y nete a la comunidad de MDN Web Docs.
This feature is well established and works across many devices and browser versions. Its been available across browsers since julio de 2015.
En una respuesta HTTP regular, el encabezado Content-Disposition indica si el contenido se espera que se muestre en lnea en el navegador, esto es, como una o como parte de una pgina web, o como un archivo adjunto, que se puede descargar y guardar localmente.
En un cuerpo multipart/form-data, el encabezado general Content-Disposition puede ser utilizado en la subparte de un cuerpo multipartes para dar informacin acerca del campo al que aplica. La subparte es delimitada por el boundary (lmite) definido en el encabezado Content-Type. Cuando se utiliza en el propio cuerpo, Content-Disposition no tiene efecto.
El encabezado Content-Disposition est definido en el contexto de mensajes MIME para correos electrnicos, pero slo un subconjuto de los parmetros posibles aplican a formularios HTTP y peticiones POST. Slo el valor form-data, como las directivas opcionales name and filename, pueden ser utilizadas en el contexto HTTP.
| Tipo de encabezado | Response header (para el cuerpo principal) General header (para una subparte de un cuerpo multipartes) |
|---|---|
| Forbidden request header | no |
El primer parmetro en el contexto HTTP o es inline (valor predeterminado, indicando que puede ser mostrado dentro de una pgina web, o como la pgina web) o attachment (indicando que ser descargado; la mayora de los navegadores mostrando un dilogo 'Guardar como', prellenado con el valor del parmetro filename, en caso de estar presente).
Content-Disposition: inline Content-Disposition: attachment Content-Disposition: attachment; filename="filename.jpg"
El primer parmetro en el contexto HTTP siempre es form-data; parmetros adicionales son insensibles a maysculas y tienen argumentos que usan sintaxis de textos entre comillas despus del signo de '='. Mltiples parmetros se separan por punto y coma (';').
Content-Disposition: form-data Content-Disposition: form-data; name="fieldName" Content-Disposition: form-data; name="fieldName"; filename="filename.jpg"
nameEs seguida de un texto que contiene el nombre del campo de HTML en el formulario a la que el contenido de la subparte refiere. Cuando se usan mltiples archivos en el mismo campo (por ejemplo, el atributo multiple de un elemento <input type=file>), puede haber varias subpartes con el mismo nombre.
Un name con valor de '_charset_' indica que la parte no es un campo HTML, sino el conjunto de caracteres predeterminado para partes sin informacin explcita sobre su conjunto de caracteres.
filenameEs seguida de un texto que contiene el nombre original del archivo transmitido. Siempre es opcional y no debe ser utilizado a ciegas por la aplicacin: informacin sobre la ruta debe ser despojada, y se debe realizar una conversin a las reglas del sistema de archivos del servidor. Este parmetro provee mayormente informacin indicativa. Cuando se usa en combinacin con Content-Disposition: attachment, es utilizado como el nombre de archivo predeterminado en caso de que se presente al usuario un dilogo de 'Guardar como'.
filename*Los parmetros filename y filename* difieren nicamente en que filename* utiliza encodeado definido en RFC 5987. Cuando ambos estn presentes en un valor de campo de encabezado simple, filename* es preferido sobre filename cuando ambos estn presentes y entendidos.
Una respuesta generando el dilogo 'Guardar como':
200 OK Content-Type: text/html; charset=utf-8 Content-Disposition: attachment; filename="genial.html" Content-Length: 22 <HTML>Gurdame!</HTML>
Este archivo simple de HTML ser guardado como una descarga regular en lugar de mostrarse en el navegador. La mayora de los navegadores propondr guardarlo como genial.html ya que es el nombre (predeterminado).
Un ejemplo de un formulario HTML, publicado usando el formato multipart/form-data que hace uso del encabezado Content-Disposition:
POST /test.html HTTP/1.1 Host: example.org Content-Type: multipart/form-data;boundary="boundary" --boundary Content-Disposition: form-data; name="campo1" valor1 --boundary Content-Disposition: form-data; name="campo2"; filename="ejemplo.txt" valor2 --boundary--
| Specification |
|---|
| Use of the Content-Disposition Header Field in the Hypertext Transfer Protocol (HTTP) # header.field.definition |
| Returning Values from Forms: multipart/form-data # section-4.2 |
Content-Disposition ms efectivamente si ambos parmetros filename y filename* estn presentes; observa todos los nombres presentes, usando el parmetro filename* si uno est disponible, incluso si el parmetro filename est incluido antes. Previamente, el primer parmetro en encontrarse sera usado, de este modo se previene el uso de un nombre ms apropiado. Mira Error 588781 en Firefox.Content-Type definiendo el lmite de un cuerpo multipartes.FormData usada para manipular datos de formulario para uso en la API XMLHttpRequest.This page was last modified on 9 abr 2026 by MDN contributors.
Reason: CORS disabledReason: CORS header 'Access-Control-Allow-Origin' does not match 'xyz'Reason: CORS header 'Access-Control-Allow-Origin' missingReason: CORS header 'Origin' cannot be addedReason: CORS preflight channel did not succeedReason: CORS request did not succeedReason: CORS request external redirect not allowedReason: CORS request not HTTPReason: Credential is not supported if the CORS header 'Access-Control-Allow-Origin' is '*'Reason: Did not find method in CORS header 'Access-Control-Allow-Methods'Reason: expected 'true' in CORS header 'Access-Control-Allow-Credentials'Reason: invalid token 'xyz' in CORS header 'Access-Control-Allow-Headers'Reason: invalid token 'xyz' in CORS header 'Access-Control-Allow-Methods'Reason: missing token 'xyz' in CORS header 'Access-Control-Allow-Headers' from CORS preflight channelReason: Multiple CORS header 'Access-Control-Allow-Origin' not allowedAcceptAccept-CHAccept-EncodingAccept-LanguageAccept-PatchAccept-PostAccept-RangesAccess-Control-Allow-CredentialsAccess-Control-Allow-HeadersAccess-Control-Allow-MethodsAccess-Control-Allow-OriginAccess-Control-Expose-HeadersAccess-Control-Max-AgeAccess-Control-Request-HeadersAccess-Control-Request-MethodActivate-Storage-AccessAgeAllowAlt-SvcAlt-UsedAttribution-Reporting-EligibleAttribution-Reporting-Register-SourceAttribution-Reporting-Register-TriggerAuthorizationAvailable-DictionaryCache-ControlClear-Site-DataConnectionSubtleCrypto.digest()Content-DispositionContent-DPRContent-EncodingContent-LanguageContent-LengthContent-LocationContent-RangeContent-Security-PolicyContent-Security-Policy-Report-OnlyContent-TypeCookieCritical-CHCross-Origin-Embedder-PolicyCross-Origin-Embedder-Policy-Report-OnlyCross-Origin-Opener-PolicyCross-Origin-Resource-PolicyDateDevice-MemoryDictionary-IDDNTDownlinkDPREarly-DataECTETagExpectExpect-CTExpiresForwardedFromHostIdempotency-KeyIf-MatchIf-Modified-SinceIf-None-MatchIf-RangeIf-Unmodified-SinceIntegrity-PolicyIntegrity-Policy-Report-OnlyKeep-AliveLast-ModifiedLinkLocationMax-ForwardsNELNo-Vary-SearchObserve-Browsing-TopicsOriginOrigin-Agent-ClusterPermissions-PolicyPermissions-Policy-Report-OnlyPragmaPreferPreference-AppliedPriorityProxy-AuthenticateProxy-AuthorizationRangeRefererReferrer-PolicyRefreshReport-ToReporting-EndpointsRepr-DigestRetry-AfterRTTSave-DataSec-Browsing-TopicsSec-CH-Device-MemorySec-CH-DPRSec-CH-Prefers-Color-SchemeSec-CH-Prefers-Reduced-MotionSec-CH-Prefers-Reduced-TransparencySec-CH-UASec-CH-UA-ArchSec-CH-UA-BitnessSec-CH-UA-Form-FactorsSec-CH-UA-Full-VersionSec-CH-UA-Full-Version-ListSec-CH-UA-MobileSec-CH-UA-ModelSec-CH-UA-PlatformSec-CH-UA-Platform-VersionSec-CH-UA-WoW64Sec-CH-Viewport-HeightSec-CH-Viewport-WidthSec-CH-WidthSec-Fetch-DestSec-Fetch-ModeSec-Fetch-SiteSec-Fetch-Storage-AccessSec-Fetch-UserSec-GPCSec-Private-State-TokenSec-Private-State-Token-Crypto-VersionSec-Private-State-Token-LifetimeSec-PurposeSec-Redemption-RecordSec-Speculation-TagsSec-WebSocket-AcceptSec-WebSocket-ExtensionsSec-WebSocket-KeySec-WebSocket-ProtocolSec-WebSocket-VersionServerServer-TimingService-WorkerService-Worker-AllowedService-Worker-Navigation-PreloadSet-CookieSet-LoginSourceMapSpeculation-RulesStrict-Transport-SecuritySupports-Loading-ModeTETiming-Allow-OriginTkTrailerTransfer-EncodingUpgradeUpgrade-Insecure-RequestsUse-As-DictionaryUser-AgentVaryViaViewport-WidthWant-Content-DigestWant-Repr-DigestWarningWidthWWW-AuthenticateX-Content-Type-OptionsX-DNS-Prefetch-ControlX-Forwarded-ForX-Forwarded-HostX-Forwarded-ProtoX-Frame-OptionsX-Permitted-Cross-Domain-PoliciesX-Powered-ByX-Robots-TagX-XSS-Protection100 Continue101 Switching Protocols102 Processing103 Early Hints200 OK201 Created202 Aceptado203 Non-Authoritative Information204 No Content205 Reset Content206 Partial Content207 Multi-Status208 Already Reported226 IM Used300 Multiple Choices301 Moved Permanently302 Found303 See Other304 Not Modified307 Temporary Redirect308 Permanent Redirect400 Peticin mala401 Unauthorized402 Payment Required403 Forbidden404 Not Found405 Method Not Allowed406 Not Acceptable407 Proxy Authentication Required408 Request Timeout409 Conflict410 Gone411 Length Required412 Precondition Failed413 Content Too Large414 URI Too Long415 Unsupported Media Type416 Range Not Satisfiable417 Expectation Failed418 Soy una tetera421 Misdirected Request422 Unprocessable Content423 Locked424 Failed Dependency425 Too Early426 Upgrade Required428 Precondition Required429 Too Many Requests431 Request Header Fields Too Large451 Unavailable For Legal Reasons500 Internal Server Error501 Not Implemented502 Puerta de enlace no vlida503 Servicio No Disponible504 Gateway Timeout505 HTTP Version Not Supported506 Variant Also Negotiates507 Insufficient Storage508 Loop Detected510 Not Extended511 Network Authentication Requiredbase-uriblock-all-mixed-contentchild-srcconnect-srcdefault-srcfenced-frame-srcfont-srcform-actionframe-ancestorsframe-srcimg-srcmanifest-srcmedia-srcobject-srcprefetch-srcreport-toreport-urirequire-trusted-types-forsandboxscript-srcscript-src-attrscript-src-elemstyle-srcstyle-src-attrstyle-src-elemtrusted-typesupgrade-insecure-requestsworker-srcaccelerometerambient-light-sensoraria-notifyattribution-reportingautoplaybluetoothbrowsing-topicscameracaptured-surface-controlch-ua-high-entropy-valuescompute-pressurecross-origin-isolateddeferred-fetchdeferred-fetch-minimaldisplay-captureencrypted-mediafullscreengamepadgeolocationgyroscopehididentity-credentials-getidle-detectionlanguage-detectorlanguage-modellocal-fontslocal-networklocal-network-accessloopback-networkmagnetometermicrophonemidion-device-speech-recognitionotp-credentialspaymentpicture-in-pictureprivate-state-token-issuanceprivate-state-token-redemptionpublickey-credentials-createpublickey-credentials-getscreen-wake-lockserialspeaker-selectionstorage-accesssummarizertranslatorusbweb-sharewindow-managementxr-spatial-trackingYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |