如何实现在点击图片下载链接时,直接弹出一个下载的窗口.而不是在新的窗口打开这个图片 如何实现在点击图片下载链接时,直接弹出一个下载的窗口.而不是在新的窗口打开这个图片 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在网上搜到可以用 jspSmartUpload解决,哪位有具体的解决方案。。指导下啊。。 用一个动态地址实现下载,如php\java\asp等都可以,读出这个文件流以文件形式输出:php:(读文件略)<?if (isset($GLOBALS["HTTP_RAW_POST_DATA"])){ // get bytearray $jpg = $GLOBALS["HTTP_RAW_POST_DATA"]; // add headers for download dialog-box header('Content-Type: image/jpeg'); header("Content-Disposition: attachment; filename=".$_GET['name']); echo $jpg;}java:(读文件略)<%@ page contentType="text/html; charset=utf-8" language="java"%> <%@ page import="java.util.*"%> <%@ page import="java.io.*"%> <% int v; String name = request.getParameter("name");BufferedInputStream inputStream=null;BufferedOutputStream bos=null;try{ bos = new BufferedOutputStream(response.getOutputStream()); inputStream = new BufferedInputStream(request.getInputStream()); response.setHeader("Content-Disposition", "attachment;filename=\"" + new String(name.getBytes(), "ISO-8859-1") + "\""); byte [] bytes = new byte[1024]; int i=0; while((v=inputStream.read(bytes))>0){ bos.write(bytes, 0, v); i++; }} catch (IOException e) { throw e;} finally { if (inputStream != null ) inputStream.close(); if (bos != null ) bos.close();} %> Struts中使用ForwardAction的问题(急死了,在线等了。。。。。。) 關於JavaMail與EXCHANGE郵件服務器設定的問題 关于JSP网页上的表格 导出到Excel的问题 jsp连接oracle问题??请高手指教 急!求救提交数据库时的中文问题…… JSP问题!~请高手指教 我的jdbc Bean还是不能正常使用! jsp的服务起怎么安装 请教在jb重视怎么调试jsp文件的,最好给个大概过程,谢谢。 org.apache.jasper.JasperException错误,求大神解答! 各位大虾帮忙看看是否可行? radio单选框问题 高手快点帮下小弟!
php:(读文件略)
<?
if (isset($GLOBALS["HTTP_RAW_POST_DATA"])){
// get bytearray
$jpg = $GLOBALS["HTTP_RAW_POST_DATA"];
// add headers for download dialog-box
header('Content-Type: image/jpeg');
header("Content-Disposition: attachment; filename=".$_GET['name']);
echo $jpg;
}
java:(读文件略)
<%@ page contentType="text/html; charset=utf-8" language="java"%>
<%@ page import="java.util.*"%>
<%@ page import="java.io.*"%>
<%
int v;
String name = request.getParameter("name");
BufferedInputStream inputStream=null;
BufferedOutputStream bos=null;
try{
bos = new BufferedOutputStream(response.getOutputStream());
inputStream = new BufferedInputStream(request.getInputStream());
response.setHeader("Content-Disposition", "attachment;filename=\"" + new String(name.getBytes(), "ISO-8859-1") + "\"");
byte [] bytes = new byte[1024];
int i=0;
while((v=inputStream.read(bytes))>0){
bos.write(bytes, 0, v);
i++;
}
} catch (IOException e) {
throw e;
} finally {
if (inputStream != null )
inputStream.close();
if (bos != null )
bos.close();
}
%>