草庐IT

nContent-Disposition

全部标签

javascript - Content-Disposition 附件是否被 XMLHttpRequest 阻止?

我想从我编写的C#网络服务器对png文件执行javascriptxhr请求。这是我使用的代码varimgUrl="http://localhost:8085/AnImage.png?"+now;varrequest=newXMLHttpRequest();request.open('GET',imgUrl,false);request.send();//thisisinatry/catch在服务器端,我发回文件并添加一个Content-Dispositionheader。我得到以下响应我确保在Content-Type之后的标题中附加了Content-Disposition(屏幕截图来自

c# - 带有文件和参数的 WebRequest POST

我正在尝试使用.NET/C#上传文件并将一些参数发送到我的网站。在阅读了一些执行一些参数或文件的教程后,我尝试将它们组合起来,但没有成功。这是我尝试这样做的方法:WebRequestreq=WebRequest.Create(baseURL+"upload");req.Credentials=newNetworkCredential(username,password);Stringboundary="B0unD-Ary";req.ContentType="multipart/form-data;boundary="+boundary;req.Method="POST";((HttpW

c# - 获取 Content-Disposition 参数

如何使用WebClient获取从WebAPIController返回的Content-Disposition参数?WebAPIController[Route("api/mycontroller/GetFile/{fileId}")]publicHttpResponseMessageGetFile(intfileId){try{varfile=GetSomeFile(fileId)HttpResponseMessageresponse=newHttpResponseMessage(HttpStatusCode.OK);response.Content=newStreamContent(

用于从 Content-Disposition header 中提取文件名的 javascript 正则表达式

Content-dispositionheader包含可以轻松提取的文件名,但有时它包含双引号,有时不带引号,并且可能还有其他一些变体。有人可以编写适用于所有情况的正则表达式吗。Content-Disposition:attachment;filename=content.txt以下是一些可能的目标字符串:attachment;filename=content.txtattachment;filename*=UTF-8''filename.txtattachment;filename="EUROrates";filename*=utf-8''%e2%82%ac%20ratesattac

PHP 强制下载 PDF 文件,即使我使用的是 Content-Disposition : inline

如果可能的话,我正在尝试在浏览器中显示PDF——我知道我可以在Chrome中执行此操作,这正是我正在测试的。问题是,每次我尝试时,它都会提示下载相反。我正在使用PHPsession,所以我知道发送了一些无关的header,所以我调用了header_remove()来重置所有内容。我调用这个函数来显示PDF:id.'.pdf';//ThelocationofthePDFif(!file_exists($file)){die('ThePDFdoesnotexist.');//Somehowthefiledoesnotexist.}header_remove();//I'musingPHPs

PHP Header Content-Disposition : attachment forces . php 文件或内联

我想从我的网站下载一个.mp3文件,但在使用此代码时,它会在Firefox和Safari中强制使用.php。但在chrome中,它会将文件强制发送为内联文件并在页面上播放。我怎样才能让他们真正下载.mp3文件?$track=$_SERVER['QUERY_STRING'];if(file_exists("/home/user/gets/".$track)){header("Content-Type:audio/mpeg");header('Content-Length:'.filesize($track));header('Content-Disposition:attachment;

PHP header : Content-disposition: attachment , 然后位置:一些 url

我的目标是在浏览器发出附件下载后将浏览器重定向到新页面。header("Content-type:text/csv");header("Cache-Control:no-store,no-cache");header("Content-disposition:attachment;filename=file.csv");//csvoutputlogichere//forwardtonextpageheader("Location:$url");这可能吗?UPDATE:以上结果CSV的最后一行显示PHP错误:Cannotmodifyheaderinformation-headersalr

PHP - 如何在 Content-Disposition 中设置完整的目录路径?

我正在将文件名传递给下载页面。即somefile.xls下载页面将完整的目录路径添加回文件名。即c:\temp\somefile.xls问题是现在设置header的“Content-Disposition”不起作用。它要下载的文件名是完整的目录文件名路径。即c_temp_somefileContent-Disposition能否处理完整路径?如果可以,我该如何让我的脚本正确下载文件?代码是:$myad=$_GET['myad'];$glob_string=realpath('/foldera/folderb/folderc').DIRECTORY_SEPARATOR.$myad;hea

PHP:RFC-2231 如何将 UTF-8 字符串编码为 Content-Disposition 文件名

场景:(在PHP中)我有一个带有UTF-8编码字符串($name)的表单提交,以支持国际字符。提交表单(通过GET)后,我正在创建一个CSV下载文件。我希望文件的名称是string+.csv("$name.csv")。对于西方字符集,我可以通过以下方式做到这一点:header("Content-Disposition:attachment;filename=\"$name\"");但对于其他字符集,下载文件的名称为乱码+.csv(如לל×כותרת.csv).我正在尝试按照RFC2231做类似的事情:header("Content-Disposition:attachme

java - 在 Jasperreports 中从服务器接收到多个不同的 Content-Disposition header

我正在尝试设置内容处置header以响应servlet,但我在浏览器中收到此错误。我该怎么办?DuplicateheadersreceivedfromserverTheresponsefromtheservercontainedduplicateheaders.Thisproblemisgenerallytheresultofamisconfiguredwebsiteorproxy.Onlythewebsiteorproxyadministratorcanfixthisissue.Error349(net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_D