[英]want to get the file name and its path which was uploaded using jquery plugin
I used a jquery plugin to upload a files into a specified folder.upload was done properly,What i want is to get the the name of the file and its path to store it in a database.I don,t know which variable i have to use get that .Here is my plugin, 我使用一个jQuery插件将文件上传到指定的文件夹中。上传已正确完成,我想要的是获取文件的名称及其存储在数据库中的路径。我不知道我有哪个变量使用get that.Here是我的插件,
$(function () {
// Change this to the location of your server-side upload handler:
var url = 'test_upload_charity.php';
$('#fileupload').fileupload({
url: url,
dataType: 'json',
done: function (e, data) {
$.each(data.result.files, function (index, file) {
$('<p/>').text(file.name).appendTo('#files');
});
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('#progress .progress-bar').css(
'width',
progress + '%'
);
}
}).prop('disabled', !$.support.fileInput)
.parent().addClass($.support.fileInput ? undefined : 'disabled');
});
And my test_upload_charity.php is 我的test_upload_charity.php是
<?php
error_reporting(E_ALL | E_STRICT);
include "UploadHandler_charity.php";
$uploadhandlerobj=new UploadHandler_charity();
$filename_uploaded=$uploadhandlerobj->get_file_name();
$file = fopen("test123456.txt","w");
echo fwrite($file,"The file is ".$filename_uploaded);
fclose($file);
?>
The UploadHandler_charity.php is UploadHandler_charity.php是
https://github.com/blueimp/jQuery-File-Upload https://github.com/blueimp/jQuery-File-Upload
In that link it was inside server folder 在该链接中,它位于服务器文件夹中
Try to use: 尝试使用:
$_FILES["file"]["name"]
I cannot find an official function in your library to get it. 我无法在您的图书馆中找到官方功能来获取它。
If that does not work you can try printing the whole _FILES array: 如果这样不起作用,您可以尝试打印整个_FILES数组:
print_r($_FILES);
and see if you can find the needed data in the array. 并查看是否可以在数组中找到所需的数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.