我有一个基于网站自定义示例的 plupload 实例,除了显示来自服务器端上传脚本(下载示例文件夹中的 upload.php)的错误消息外,它工作正常。
正在显示本地错误消息,例如,如果我尝试上传受限制的文件类型,我会收到我期望的错误消息,但是,服务器端消息不会显示。
我知道 upload.php 文件被正确触发,因为我的上传已成功处理,并且我设置了一个休眠功能来验证是否正在请求文件。 当时我只是简单地在我的 upload.php 顶部放置了一行以协助调试,它只是休眠 10 秒并返回一条错误消息,这仍然不起作用。
upload.php
sleep(10);
die('{"jsonrpc" : "2.0", "error" : {"code": 500, "message": "THIS IS AN ERROR."}, "id" : "id"}');
...(Rest of normal upload.php file)...
我正在使用的 javascript 包含在下面,非常感谢你们能提供的任何帮助,因为我已经在这上面花了太长时间,而且这个问题阻碍了我能够将我的代码推送到现场。
谢谢,
亚历克斯
// Fanart
$(function() {
var fanart_uploader = new plupload.Uploader({
runtimes : 'html5,flash,html4',
browse_button : 'fanart_pickfiles',
container : 'fanart_container',
drop_element : 'fanart_drop',
chunk_size : '1mb',
max_file_size : '8mb',
url : '/upload.php?gameid=<?= $gameid ?>&arttype=fanart',
flash_swf_url : '/js/plupload/js/plupload.flash.swf',
silverlight_xap_url : '/js/plupload/js/plupload.silverlight.xap',
filters : [
{title : "Image files", extensions : "jpg,png"},
]
});
fanart_uploader.bind('Init', function(up, params) {
$('#fanart_runtime').html("You are using " + params.runtime);
});
$('#fanart_uploadfiles').click(function(e) {
fanart_uploader.start();
e.preventDefault();
});
fanart_uploader.init();
fanart_uploader.bind('FilesAdded', function(up, files) {
$.each(files, function(i, file) {
$('#fanart_filelist').append(
'<div style="padding: 4px; margin: 3px; border: 1px dotted #fff; border-radius: 6px; background-color: #333;" id="' + file.id + '"><img class="tick" src=\"<?= $baseurl ?>/images/common/icons/tick_16.png\" style=\"display: none; vertical-align: -2px;\" />' +
file.name + ' <em>(' + plupload.formatSize(file.size) + ')</em> <div style=\"margin: auto; margin-top: 3px; width: 200px; height: 20px; border: 1px solid #fff; border-radius: 6px; background-color: #222;\"><div class="progressbar" style=\"width: 0px; height: 16px; padding: 2px 0px; background-color: #ccc; border-radius: 6px; text-align: center;\"><b style="font-size: 16px; color: #222;"></b></div></div>' +
'</div>');
});
up.refresh(); // Reposition Flash/Silverlight
});
fanart_uploader.bind('UploadProgress', function(up, file) {
$('#' + file.id + " b").html(file.percent + "%");
$('#' + file.id + " .progressbar").css("width", (file.percent * 2));
});
fanart_uploader.bind('Error', function(up, err) {
$('#fanart_filelist').append("<div>Error: " + err.code +
", Message: " + err.message +
(err.file ? ", File: " + err.file.name : "") +
"</div>"
);
up.refresh(); // Reposition Flash/Silverlight
});
fanart_uploader.bind('FileUploaded', function(up, file) {
$('#' + file.id + " .tick").show();
});
});
最佳答案
这是您链接到的答案:
NM, Answered my own question...
It seems my plUpload instance relieves the server response which is a JSON string into a JS object which can be accessed through the "FileUploaded" event.
This is a code example for anyone else who needs this answer.
fanart_uploader.bind('FileUploaded', function(up, file, info) { $('#' + file.id + " .tick").show(); printObject(info); var response = jQuery.parseJSON(info.response); alert(response.error.message); });
关于php - plUpload - 服务器端错误未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10720179/
我正在尝试使用ruby和Savon来使用网络服务。测试服务为http://www.webservicex.net/WS/WSDetails.aspx?WSID=9&CATID=2require'rubygems'require'savon'client=Savon::Client.new"http://www.webservicex.net/stockquote.asmx?WSDL"client.get_quotedo|soap|soap.body={:symbol=>"AAPL"}end返回SOAP异常。检查soap信封,在我看来soap请求没有正确的命名空间。任何人都可以建议我
我想安装一个带有一些身份验证的私有(private)Rubygem服务器。我希望能够使用公共(public)Ubuntu服务器托管内部gem。我读到了http://docs.rubygems.org/read/chapter/18.但是那个没有身份验证-如我所见。然后我读到了https://github.com/cwninja/geminabox.但是当我使用基本身份验证(他们在他们的Wiki中有)时,它会提示从我的服务器获取源。所以。如何制作带有身份验证的私有(private)Rubygem服务器?这是不可能的吗?谢谢。编辑:Geminabox问题。我尝试“捆绑”以安装新的gem..
我得到了一个包含嵌套链接的表单。编辑时链接字段为空的问题。这是我的表格:Editingkategori{:action=>'update',:id=>@konkurrancer.id})do|f|%>'Trackingurl',:style=>'width:500;'%>'Editkonkurrence'%>|我的konkurrencer模型:has_one:link我的链接模型:classLink我的konkurrancer编辑操作:defedit@konkurrancer=Konkurrancer.find(params[:id])@konkurrancer.link_attrib
大约一年前,我决定确保每个包含非唯一文本的Flash通知都将从模块中的方法中获取文本。我这样做的最初原因是为了避免一遍又一遍地输入相同的字符串。如果我想更改措辞,我可以在一个地方轻松完成,而且一遍又一遍地重复同一件事而出现拼写错误的可能性也会降低。我最终得到的是这样的:moduleMessagesdefformat_error_messages(errors)errors.map{|attribute,message|"Error:#{attribute.to_s.titleize}#{message}."}enddeferror_message_could_not_find(obje
我主要使用Ruby来执行此操作,但到目前为止我的攻击计划如下:使用gemsrdf、rdf-rdfa和rdf-microdata或mida来解析给定任何URI的数据。我认为最好映射到像schema.org这样的统一模式,例如使用这个yaml文件,它试图描述数据词汇表和opengraph到schema.org之间的转换:#SchemaXtoschema.orgconversion#data-vocabularyDV:name:namestreet-address:streetAddressregion:addressRegionlocality:addressLocalityphoto:i
所以我在关注Railscast,我注意到在html.erb文件中,ruby代码有一个微弱的背景高亮效果,以区别于其他代码HTML文档。我知道Ryan使用TextMate。我正在使用SublimeText3。我怎样才能达到同样的效果?谢谢! 最佳答案 为SublimeText安装ERB包。假设您安装了SublimeText包管理器*,只需点击cmd+shift+P即可获得命令菜单,然后键入installpackage并选择PackageControl:InstallPackage获取包管理器菜单。在该菜单中,键入ERB并在看到包时选择
最近,当我启动我的Rails服务器时,我收到了一长串警告。虽然它不影响我的应用程序,但我想知道如何解决这些警告。我的估计是imagemagick以某种方式被调用了两次?当我在警告前后检查我的git日志时。我想知道如何解决这个问题。-bcrypt-ruby(3.1.2)-better_errors(1.0.1)+bcrypt(3.1.7)+bcrypt-ruby(3.1.5)-bcrypt(>=3.1.3)+better_errors(1.1.0)bcrypt和imagemagick有关系吗?/Users/rbchris/.rbenv/versions/2.0.0-p247/lib/ru
在Rails4.0.2中,我使用s3_direct_upload和aws-sdkgems直接为s3存储桶上传文件。在开发环境中它工作正常,但在生产环境中它会抛出如下错误,ActionView::Template::Error(noimplicitconversionofnilintoString)在View中,create_cv_url,:id=>"s3_uploader",:key=>"cv_uploads/{unique_id}/${filename}",:key_starts_with=>"cv_uploads/",:callback_param=>"cv[direct_uplo
我遵循MichaelHartl的“RubyonRails教程:学习Web开发”,并创建了检查用户名和电子邮件长度有效性的测试(名称最多50个字符,电子邮件最多255个字符)。test/helpers/application_helper_test.rb的内容是:require'test_helper'classApplicationHelperTest在运行bundleexecraketest时,所有测试都通过了,但我看到以下消息在最后被标记为错误:ERROR["test_full_title_helper",ApplicationHelperTest,1.820016791]test
我试图在索引页中创建一个超链接,但它没有显示,也没有给出任何错误。这是我的index.html.erb代码。ListingarticlesTitleTextssss我检查了我的路线,我认为它们也没有问题。PrefixVerbURIPatternController#Actionwelcome_indexGET/welcome/index(.:format)welcome#indexarticlesGET/articles(.:format)articles#indexPOST/articles(.:format)articles#createnew_articleGET/article