我刚刚购买了精美的上传器,但我无法让它工作。我想在 xampp 和 php 中使用它,而不使用 s3。
这是索引.php:
<html>
<head>
<link href="fineuploader-3.8.2.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="fine-uploader">
</div>
<script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="jquery.fineuploader-3.8.2.min.js" type="text/javascript"></script>
<script>
// Wait until the DOM is 'ready'
$(document).ready(function () {
$("#fine-uploader").fineUploader({
debug: true,
request: {
endpoint: 'php.php'
},
retry: {
enableAuto: true
}
});
});
</script>
</body>
</html>
然后 php.php 来自服务器存储库:
<?php
// list of valid extensions, ex. array("jpeg", "xml", "bmp")
$allowedExtensions = array();
// max file size in bytes
$sizeLimit = 10 * 1024 * 1024;
//require('fine-uploader/server/php.php');
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
// Call handleUpload() with the name of the folder, relative to PHP's getcwd()
$result = $uploader->handleUpload('uploads/');
// to pass data through iframe you will need to encode all html tags
echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
/**
* Handle file uploads via XMLHttpRequest
*/
class qqUploadedFileXhr {
...
上传文件夹存在并且是可写的(因为我在本地工作)。那么问题出在哪里呢?我是否需要 qqFileUploader.php不知何故,它也在存储库中?
任何人都可以提供 php 的工作示例吗?
非常感谢和亲切的问候
奈蒂克
PHP 示例现在应该更容易理解。 我调整了文档,删除了一些冗余和不必要的文件,并重新组织了目录结构。 现在,对于传统终结点(例如你的终结点),应将客户端终结点指向"终结点.php"文件,该文件需要"handler.php"文件。 Widen 支持的 php 示例位于 Github 上的 Widen/fine-uploader-server 存储库中 php/traditional 目录的根目录中。 还有 S3 端点(在 php/s3 目录中)和 Lithium 框架(不是由 Widen 维护,而是位于 php/traditional/li3 中)的例子。