uploadify-3.1 上传不提交到后台报错HTTP Error (404)或IO Error 我后台用的是servlet 10
-----------------------------------------页面------------------------------------------...
-----------------------------------------页面---------------------------------------------------------
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>Uploadify</title>
<link rel="stylesheet" href="css/uploadify.css" type="text/css"></link>
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="js/jquery.uploadify-3.1.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#uploadify").uploadify({
'debug' : true,
'swf' : 'uploadify.swf',
'method' : 'post',
'uploader' : '/Upload',
'cancelImg' : 'cancel.png',
'folder' : 'uploads',
'queueID' : 'fileQueue',
'auto' : false,
'multi' : true,
'simUploadLimit' : 2,
'buttonText' : 'BROWSE'
});
});
</script>
</head>
<body>
<div id="fileQueue"></div>
<input type="file" name="uploadify" id="uploadify" />
<p>
<a href="javascript:$('#uploadify').uploadify('upload','*');">开始上传</a>
</p>
</body>
</html>
--------------------------------------web.xml----------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_3_0.xsd">
<servlet>
<servlet-name>Upload</servlet-name>
<servlet-class>servlet.Upload</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Upload</servlet-name>
<url-pattern>/Upload</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
-----------------------------------------servlet------------------------------------------------ 展开
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>Uploadify</title>
<link rel="stylesheet" href="css/uploadify.css" type="text/css"></link>
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="js/jquery.uploadify-3.1.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#uploadify").uploadify({
'debug' : true,
'swf' : 'uploadify.swf',
'method' : 'post',
'uploader' : '/Upload',
'cancelImg' : 'cancel.png',
'folder' : 'uploads',
'queueID' : 'fileQueue',
'auto' : false,
'multi' : true,
'simUploadLimit' : 2,
'buttonText' : 'BROWSE'
});
});
</script>
</head>
<body>
<div id="fileQueue"></div>
<input type="file" name="uploadify" id="uploadify" />
<p>
<a href="javascript:$('#uploadify').uploadify('upload','*');">开始上传</a>
</p>
</body>
</html>
--------------------------------------web.xml----------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_3_0.xsd">
<servlet>
<servlet-name>Upload</servlet-name>
<servlet-class>servlet.Upload</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Upload</servlet-name>
<url-pattern>/Upload</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
-----------------------------------------servlet------------------------------------------------ 展开
展开全部
这样写就直接到后台,触发上传了。和php不一样,这边必须写servlet的后台处理程序
$("#file_upload").uploadify({
'uploader' : '<%=basePath%>/servlet/Upload',
$("#file_upload").uploadify({
'uploader' : '<%=basePath%>/servlet/Upload',
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
路径问题,
/Upload update to Upload 即可解决404找不到路径的 http error
1.首先确保请求能进入后台
2.处理请求过来的数据.
3.完成后再做进一步的修改和完善.
希望对你有所帮助.
/Upload update to Upload 即可解决404找不到路径的 http error
1.首先确保请求能进入后台
2.处理请求过来的数据.
3.完成后再做进一步的修改和完善.
希望对你有所帮助.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
应该是这里的问题:
'uploader' : '/Upload',
尝试写成绝对路径调试一下看看
'uploader' : '/Upload',
尝试写成绝对路径调试一下看看
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
'uploader' : '/Upload',
这个地方是提交到后台得路径吧。写绝对地址试试
"<%=basePath%>/Upload"
这个地方是提交到后台得路径吧。写绝对地址试试
"<%=basePath%>/Upload"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询