我现在正在处理一个上传脚本,它用 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');
}
?>
我不知道可能出了什么问题..任何帮助表示赞赏