我在测试网站(Win7 xampp/apache 服务器)上使用 FineUploader 3.5
我的图像可以拖放并上传到我的上传目录就好了。当我单击删除链接时,我会删除文件列表中的文件,但不会删除上传文件夹中的实际文件,图像也会保留。我已经在 deleteFile: 中设置了端点,但它似乎永远不会执行它。
function createImageUploaders() {
var freeimagesuploader = new qq.FineUploader({
// Pass the HTML element here
element: document.getElementById('free-images-uploader'),
// or, if using jQuery
// element: $('#free-images-uploader')[0],
// Use the relevant server script url here
// if it's different from the default “/server/upload”
request: {
endpoint: '<?php echo $baseurl?>components/com_classifiedsredux/library/uploader.php'
},
multiple: true,
validation: {
allowedExtensions: ['jpeg', 'jpg', 'gif', 'png'],
//sizeLimit: 204800, // 200 kB = 200 * 1024 bytes
sizeLimit: 5120000, // 5 mb or 5000 kB = 5000 * 1024 bytes
itemLimit: 3
},
text: {
uploadButton: "<div> <i class='icon-upload icon-white'></i> Click or Drag n' Drop images to upload </div>",
dragZone: 'Drop images here to upload',
},
deleteFile: {
enabled: true,
forceConfirm: true,
endpoint: '$this->baseurl' + 'components/com_classifiedsredux/library/deletefile.php'
},
failedUploadTextDisplay: {
mode: 'custom',
maxChars: 40,
responseProperty: 'error',
enableTooltip: true
},
debug: true,
callbacks: {
onComplete: function(id, fileName, responseJSON) {
if (responseJSON.success) {
$('#free-images-uploader').append('<img src="<?php echo $baseurl?>images/com_classifiedsredux/ads/originals/' + fileName + '" alt="' + fileName + '" style="height:60px; display:inline"> ');
}
},
onDeleteComplete: function(id) {
// if (responseJSON.success) {
$('#free-images-uploader').append(id + ' dropped');
// }
}
}
});
这是 webconsole 日志,我拖放 3 个图像:
[08:40:27.642] [FineUploader] Grabbed 3 dropped files. [08:40:27.643] [FineUploader] Processing 3 files or inputs... [08:40:27.647] [FineUploader] Sending upload request for 0 [08:40:27.649] [FineUploader] Sending upload request for 1 [08:40:27.652] [FineUploader] Sending upload request for 2 [08:40:27.795] POST http : //j3demo/components/com_classifiedsredux/library/uploader.php [HTTP/1.1 200 OK 20ms] [08:40:27.796] POST http : //j3demo/components/com_classifiedsredux/library/uploader.php [HTTP/1.1 200 OK 59ms] [08:40:27.797] POST http : //j3demo/components/com_classifiedsredux/library/uploader.php [HTTP/1.1 200 OK 61ms] [08:40:27.858] GET http : //j3demo/components/com_classifiedsredux/images/loading.gif [HTTP/1.1 304 Not Modified 41ms] [08:40:27.777] [FineUploader] xhr - server response received for 0 [08:40:27.777] [FineUploader] responseText = {"success":true,"uploadName":"AD2-365.jpg"} [08:40:27.789] [FineUploader] xhr - server response received for 2 [08:40:27.789] [FineUploader] responseText = {"success":true,"uploadName":"eibAD4-783.gif"} [08:40:27.803] [FineUploader] xhr - server response received for 1 [08:40:27.803] [FineUploader] responseText = {"success":true,"uploadName":"AD3-433.gif"} [08:40:27.953] GET http : //j3demo/images/com_classifiedsredux/ads/originals/AD2.jpg [HTTP/1.1 304 Not Modified 4ms] [08:40:27.956] GET http : //j3demo/images/com_classifiedsredux/ads/originals/eibAD4.gif [HTTP/1.1 304 Not Modified 3ms] [08:40:27.958] GET http : //j3demo/images/com_classifiedsredux/ads/originals/AD3.gif [HTTP/1.1 304 Not Modified 5ms]
,然后我删除第二个:
[08:40:34.000] [FineUploader] Sending DELETE request for 1
[08:40:34.001] [FineUploader] Submitted delete file request for 1
[08:40:34.140] DELETE http : //j3demo/components/com_classifiedsredux/library/deletefile.php/0cc36f82-5684-4b37-b0f9-6a065ace91b4? [HTTP/1.1 200 OK 11ms]
[08:40:34.075] [FineUploader] Delete request for 'AD3.gif' has succeeded.