[英]HTMLDOM: How to change text “files selected” from upload button using jquery or javascript?
[英]Plupload unable to upload files over 940kb, this is the issue with larger files
使用 pluploader 上传文件时,小文件可以毫无问题地上传,但是一旦文件被分块,脚本就会丢失实际文件名,从而导致以下错误:
Failed to open input stream
所以,我需要一种方法将实际文件名从 HTML 表单传递到上传custom.html
文件中有一行内容为:
browse_button : 'pickfiles', // you can pass an id...
container: document.getElementById('container'), // ... or DOM Element itself
在 DOM 中,我需要的元素是此脚本部分中的file.name
FilesAdded: function(up, files) {
plupload.each(files, function(file) {
document.getElementById('filelist').innerHTML += '<div id="' + file.id +
'">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></div>';
});
谁能建议我如何实现这一目标? 我尝试使用 java 和 isset 访问该元素,但没有成功。
在 plupload 中有一个名为 upload.php 的主要上传脚本,这是将上传文件重命名为无意义代码的代码,即 file_6272e003ad256,这是 upload.php 中的代码,重命名该文件 ID 名称
// Check if file has been uploaded
if (!$chunks || $chunk == $chunks - 1) {
// Strip the temp .part suffix off
rename("{$filePath}.part", $filePath);
所以,在这个文件中搜索文件名这个词
// What to look for
$search = 'filename';
// Read from file
$lines = file('file_6272e003ad256');
foreach($lines as $line)
{
// Check if the line contains the string we're looking for, and print if it does
if(strpos($line, $search) !== false)
echo $line;
}
然后提取双引号之间的短语,这是要重命名文件的文件名
rename($filePath, $original_filename);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.