- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在远程服务器上移动上传。在我选择带有以下代码的文件并单击上传文件后,文件已上传,但返回错误代码:“-200”消息:“HTTP 错误”
var uploader = new plupload.Uploader(
{
runtimes : 'html4, html5, flash, silverlight',
browse_button : 'bt_browse',
container: document.getElementById('container'),
url : 'http://remote.com/upload.php',
silverlight_xap_url : 'js/Moxie.xap',
chunks_size: '20mb',
max_retries: 3,
filters : {
max_file_size : '100mb'
},
multi_selection : true,
init: {
PostInit: function() {
document.getElementById('filelist').innerHTML = '';
document.getElementById('bt_uploadfiles').onclick = function() {
uploader.start();
return false;
};
},
FilesAdded: function(up, files) {
plupload.each(files, function(file) {
//build list
}},
UploadProgress: function(up, file) {
$("#progressBar"+file.id).val(Math.round(file.percent));
if(Math.round(file.percent)==100){
$("#progressBar"+file.id).hide();
$("#deleteFile" + file.id).hide();
}
},
FileUploaded: function(up, file, info) {
if(file!=undefined) {
var json = $.parseJSON(info.response);
if(json.error == undefined)
moveFile(json.result, file.name, file.id);
}
},
UploadComplete: function(){
},
Error: function(up, err) {
}
}
});
最佳答案
我在 MVC5 应用程序中使用 PlUpload 时遇到了同样的错误。问题是找不到 REST 方法。 PlUpload 使用多部分数据。下面的代码显示了如何在 WebAPI 中实现它
public class UploadFilesController : ApiController
{
[HttpPost]
[Route("UploadFiles")]
public async Task<HttpResponseMessage> PostFormData()
{
// Check if the request contains multipart/form-data.
if (!Request.Content.IsMimeMultipartContent())
{
throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
}
string root = HttpContext.Current.Server.MapPath("~/App_Data");
var provider = new MultipartFormDataStreamProvider(root);
try
{
// Read the form data.
await Request.Content.ReadAsMultipartAsync(provider);
var TestId = provider.FormData.Get("TestId");
var chunk = provider.FormData.Get("chunk");
var chunks = provider.FormData.Get("chunks");
var fileName = provider.FormData.Get("name");
int chunkId = Convert.ToInt32(chunk);
int totalChunks = Convert.ToInt32(chunks);
Boolean isLastChunch = chunkId == totalChunks - 1;
foreach (MultipartFileData file in provider.FileData)
{
//Console.WriteLine(file.Headers.ContentDisposition.FileName);
//Console.WriteLine("Server file path: " + file.LocalFileName);
string FileDestination = Path.GetDirectoryName(file.LocalFileName) + @"\" + fileName;
using (FileStream fileUpload = new FileStream(file.LocalFileName, FileMode.Open))
{
using (var fs = new FileStream(FileDestination, chunkId == 0 ? FileMode.Create : FileMode.Append))
{
var buffer = new byte[fileUpload.Length];
fileUpload.Read(buffer, 0, buffer.Length);
fs.Write(buffer, 0, buffer.Length);
}
}
File.Delete(file.LocalFileName);
}
if (isLastChunch) {
// Do something with the completed file
}
return Request.CreateResponse(HttpStatusCode.OK);
}
catch (System.Exception e)
{
return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e);
}
}
关于cross-domain - Plupload 错误 -200 HTTP 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23696634/
我遇到了搜索引擎优化问题,用户可以通过指定任何子域访问我的站点。这会导致 SEO 出现重复页面问题。 例如,如果用户错误输入“www”然后在论坛上发布了一个链接,则谷歌正在抓取“wwww.domain
这个问题在这里已经有了答案: 关闭10 年前。 Possible Duplicates: Can I change all my links to just //? Network-Path Ref
我正在玩 lighttpd在小型虚拟专用服务器上。我两个域指向服务器。我在 Ubuntu 8.10 上使用最新版本的 lighttpd 和 mod_evhost。 我正在尝试设置一个规则,这样如果任何
我正在开发一个由 domain.ext 提供的网络应用程序。此 Web 应用程序使用基于 cookie 的 session ,并为用户提供在子域上托管包含自定义 JavaScript 的网页的能力,例
我想重定向: 情况一、example.com到subdomain.example.com 情况2.www.example.com到subdomain.example.com 我已将这两段代码放入我的
我遇到了“领域对象”这个术语,并在 Google 上找到了几个定义,但我只是想验证我的理解是否正确。 这是否只是表示业务规则的任何类 - 因为“域”一词通常表示特定于某些本地问题集的规则,例如如何计算
将我们的应用程序静态内容托管在一个完全不同的域上而不是像其他域一样托管在我们主域的子域上有什么好处吗?例如微软使用 i.microsoft.com,谷歌使用 gstatic.com,雅虎使用 yimg
Orbited的客户端JS组件( cometd 服务器),要求如果服务器运行在与 JS 本身不同的域或端口上,则必须执行 document.domain = document.domain; 在加载任
我通读了另一篇文章,但似乎没有人回答我一直遇到的问题。是否可以使用通配符域的通配符子域(即使它仅用于子域而不是子子域),例如:foo.example.local。 我已经有 example.local
我在 Google Domains 上有一个域名,我想指向我在家里的 raspberry pi 服务器上运行的网站。我的公共(public) IP 地址是动态的,当 IP 更新时,我无法弄清楚如何保持
我有这个经典的 DDD 问题;我有一个做一些事情的域服务“DetectPriority”。 PM 要求我创建 2 个不同的服务;一个 INTERNAL(包含完整的业务规则并涉及许多其他领域模型)和另一
An interesting thread我刚才输入这个问题时就出现了。但我认为它没有回答我的问题。 我一直在使用 .NET MVC3 进行大量工作,因此需要一个贫乏的模型。 View 模型和编辑模型
我正在通过docker-compose运行最新版本的Artifactory OSS(如here和here所述)。我的docker-compose文件看起来像这样: version: '2' servi
我正在阅读 MDC entry for nsICookieManager2.add它讨论了域和非域 cookie。这两种类型的 cookie 有什么区别? 最佳答案 来自 RFC2109: Host
这是我的问题:http://regexr.com?2temn 我相信对于你们中的一些正则表达式大师来说这很简单。 干杯! 最佳答案 这也有效: (?<=\.|)\w+\.\w+$ 仅使用 PHP 进行
这应该很简单,但我无法理解。有许多好的和坏的正则表达式方法来匹配 URL,有或没有协议(protocol),有或没有 www。我遇到的问题是这个(在 javascript 中):如果我使用正则表达式来
我有一个网站 http://mywebsite.tld ,我想将 www.mywebsite.tld 重定向到 http://mywesite.tld (所以 www=>非 www) (防止重复内容)
TL;DR 我应该从 www.domain.tld 重定向到 domain.tld 还是相反? 我正在运行一个处理多个域的 CMS。到目前为止,CMS 负责将 www.domain.tld 重定向到
我目前有以下代码: string user = @"DOMAIN\USER"; string[] parts = user.Split(new string[] { "\\" }, StringSpl
使用 Go 和 AWS-SDK 我正在尝试查询 AWS 控制台中 Route53 -> Hosted Zones 下列出的 route53 CNAME 和 A 记录。我可以使用以下代码进行查询,但它需
我是一名优秀的程序员,十分优秀!