我现在正在使用上传脚本工作,该脚本使用ID3标签标记我的数据。 此时此刻,我可以上传3MB到10MB的小文件,但是如果我想上传大于85M的文件,它就不再起作用而且它会返回空数组
Array ()
Array ()
另一方面,我配置了我的php运行时允许上传高达150M。 以下是我的代码
<?php
// Starting session
session_start();
error_reporting(E_ALL);
//// loading configuration
require_once '../lib/config.php';
require_once '../vendor/autoload.php';
print_r($_POST);
print_r($_FILES);
if ((isset($_POST)) && (!isset($_SESSION['AIRTIME_3RDPARTY_UPLOADER']))) {
// Post variables
$date = $_POST['date'];
$show = $_POST['show'];
$presenter = $_POST['presenter'];
$desc = $_POST['description'];
$file = $_FILES['files'];
date_default_timezone_set('Europe/Berlin');
// config for file handling (where to put)
$upload_dir = $config['airtime']['upload'];
$baseFilename = basename($file['name']);
$explodeName = explode(".", $baseFilename);
$newName = $explodeName[0] . "-" . date('dMY') . "-" . uniqid();
$finalName = $newName . "." . $explodeName[1];
$upload = $upload_dir . $finalName;
$getFileSize = ($file['size'] / 1024) / 1024;
if ($getFileSize > $config['airtime']['upload_size']) {
print('Your file is to big for this system');
}
// only allowing the filetpyes within the array
$allowed_filtypes = array('audio/mp3', 'audio/ogg', 'audio/vnd.wave', 'audio/mp4');
// Check if there is any error with uploading the file
if ($file["error"] > 0) {
print_r($file);
} else {
if (in_array($file['type'], $allowed_filtypes)) {
// Initialize getID3 tag-writing module
$tagwriter = new getid3_writetags();
//$tagwriter->filename = '/path/to/file.mp3';
$tagwriter->filename = $file['tmp_name'];
$tagwriter->tagformats = array('id3v1', 'id3v2.3');
// set various options (optional)
$tagwriter->overwrite_tags = true;
$tagwriter->tag_encoding = $TaggingFormat;
$tagwriter->remove_other_tags = true;
// Populating Data Array
$TagData = array(
'title' => array($show . "-" . $date),
'artist' => array($presenter),
'year' => array(date('Y')),
'genre' => array('Radioshow'),
'comment' => array($desc)
);
// assigning Data to Variable
$tagwriter->tag_data = $TagData;
// write tags
$tagwriter->WriteTags();
// Moving file to repo
move_uploaded_file($file['tmp_name'], $upload);
//header
header('Location: submit_success.php');
} else {
header('Location: submit_fail.php');
}
}
} else {
print('Wrong form key');
}
?>
我不知道会出现什么问题...... 任何帮助表示赞赏
答案 0 :(得分:2)
听起来您忘了增加post_max_size
,增加upload_max_filesize
通常是不够的,因为post_max_size
默认值通常也相对较小。
http://www.php.net/manual/en/ini.core.php#ini.post-max-size
上传大于此限制的文件时,$_POST
和$_FILES
将为空。