Javascript 无法确认在Plupload上启动上载进程
我一直在为plUpload编写一个页面,让它与ColdFusion一起工作,看看在我的一个ColdFusion系统中实现它的可行性。。。一旦我确定它能工作,我就计划使用JS脚本和CSS的本地副本。到目前为止,前端看起来不错,但我无法确定为什么没有调用ColdFusion上传页面Javascript 无法确认在Plupload上启动上载进程,javascript,coldfusion,plupload,Javascript,Coldfusion,Plupload,我一直在为plUpload编写一个页面,让它与ColdFusion一起工作,看看在我的一个ColdFusion系统中实现它的可行性。。。一旦我确定它能工作,我就计划使用JS脚本和CSS的本地副本。到目前为止,前端看起来不错,但我无法确定为什么没有调用ColdFusion上传页面upload\u files.cfm。。。我已经在ColdFusion页面中加入了一些CFMAIL标签,以确保我正在运行某些东西…但可惜没有收到电子邮件…如果有人能指出我在这里做错了什么,我会很高兴的 我将主前端基于一个名
upload\u files.cfm
。。。我已经在ColdFusion页面中加入了一些CFMAIL标签,以确保我正在运行某些东西…但可惜没有收到电子邮件…如果有人能指出我在这里做错了什么,我会很高兴的
我将主前端基于一个名为custom.HTML的HTML页面:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Plupload - Custom example</title>
<link type="text/css" rel="stylesheet" href="http://www.plupload.com/css/bootstrap.css" media="screen" />
<link type="text/css" rel="stylesheet" href="http://www.plupload.com/css/font-awesome.min.css" media="screen" />
<link type="text/css" rel="stylesheet" href="http://www.plupload.com/css/my.css" media="screen" />
<link type="text/css" rel="stylesheet" href="http://www.plupload.com/css/prettify.css" media="screen" />
<link type="text/css" rel="stylesheet" href="http://www.plupload.com/css/shCore.css" media="screen" />
<link type="text/css" rel="stylesheet" href="http://www.plupload.com/css/shCoreEclipse.css" media="screen" />
<link type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/smoothness/jquery-ui.min.css" media="screen" />
<link type="text/css" rel="stylesheet" href="http://www.plupload.com/plupload/js/jquery.ui.plupload/css/jquery.ui.plupload.css" media="screen" />
<!-- production -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js" charset="UTF-8"></script>
<script type="text/javascript" src="../js/plupload.full.min.js"></script>
</head>
<body style="font: 13px Verdana; background: #eee; color: #333">
<h1>Custom example</h1>
<p>Shows you how to use the core plupload API.</p>
<div id="uploader">
<p>Your browser doesn't have Flash, Silverlight or HTML5 support.</p>
</div>
<script type="text/javascript">
// Initialize the widget when the DOM is ready
$(function() {
$("#uploader").plupload({
// General settings
runtimes : 'html5,html4',
url : "upload_files.cfm",
// Maximum file size
max_file_size : '2mb',
chunk_size: '1mb',
// Resize images on clientside if we can
resize : {
width : 200,
height : 200,
quality : 90,
crop: true // crop to exact dimensions
},
// Specify what files to browse for
filters : [
{title : "Image files", extensions : "jpg,gif,png"},
{title : "Zip files", extensions : "zip,avi"}
],
// Rename files by clicking on their titles
rename: true,
// Sort files
sortable: true,
// Enable ability to drag'n'drop files onto the widget (currently only HTML5 supports that)
dragdrop: true,
// Views to activate
views: {
list: true,
thumbs: true, // Show thumbs
active: 'thumbs'
},
// Flash settings
flash_swf_url : '/plupload/js/Moxie.swf',
// Silverlight settings
silverlight_xap_url : '/plupload/js/Moxie.xap'
});
});
</script>
<script type="text/javascript" src="http://www.plupload.com/js/bootstrap.js" charset="UTF-8"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="http://www.plupload.com/plupload/js/plupload.full.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="http://www.plupload.com/plupload/js/jquery.ui.plupload/jquery.ui.plupload.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="http://www.plupload.com/js/themeswitcher.js" charset="UTF-8"></script>
</body>
</html>
我已确保在
uploadfiles.cfm
中的表单.name
cfparam
标记中设置了默认文件名,并将Application.cfc
文件重新编写为标准cfcomponent
版本,而不是之前的cfscript
版本
似乎它在cfscript
标记中的output=false
语句中失败了……但我无法从plUpload例程中确定这一点
感谢提醒!使用cfmail并不是一种特别简单的检查.cfm页面是否正在执行的方法,例如,您的邮件服务器可能也存在阻止电子邮件发送的问题。如果您直接调用upload_files.cfm,即通过向其提交普通表单,而不是使用plupload?当您使用浏览时,会发生什么情况r dev tools,你在网络面板中看到了什么?@Duncan,我发现了一些你的建议中的错误…我会马上给出答案…非常感谢。
<!---
The Name field represents the filename as it exists on the client
machine.
--->
<!--- I've added the CFMAIL below as debug, so far, no emails come through... --->
<cfmail from="err@lymlive.com.au" to="eliseo.dannunzio@lymlive.com.au" subject="Test" type="html">
foo bar
</cfmail>
<cfparam name="form.name" type="string" />
<!---
The File field represents the TMP file into which the binary
data of the upload is being stored. This can be accessed via
CFFile/Upload.
--->
<cfparam name="form.file" type="string" />
<!--- Sleep for a brief period to allow UI a chance to show. --->
<!--- ------------------------------------------------------ --->
<cfset sleep( 1000 ) />
<!--- ------------------------------------------------------ --->
<!--- Save the file to the uploads directory. --->
<cffile
result="upload"
action="upload"
filefield="file"
destination="#application.uploadsDirectory#"
nameconflict="makeunique"
/>
<!--- Return a success message. --->
<cfheader
statuscode="201"
statustext="Created"
/>
<cfscript>
component
output = "false"
hint = "I define the application settings and event handlers."
{
// Define the application settings.
this.name = hash( getCurrentTemplatePath() );
this.applicationTimeout = createTimeSpan( 0, 0, 10, 0 );
this.sessionManagement = false;
// I initialize the application.
function onApplicationStart(){
// Get the root directory of the demo.
var rootDirectory = getDirectoryFromPath( getCurrentTemplatePath() );
// Set up the uploads directory.
application.uploadsDirectory = (rootDirectory & "uploads/");
// Return true so the application can load.
return( true );
}
// I initialize the request.
function onRequestStart(){
// Check to see if we need to manually reset the application.
if (structKeyExists( url, "init" )){
this.onApplicationStart();
}
// Return true so the page can load.
return( true );
}
}
</cfscript>