在 Uplodify 中将时间添加到上传文件的末尾


Add time to the end of a uploaded file in Uplodify

好的,所以我一直在尝试让它工作,我没有看到任何错误,但我的语法检查器发誓第 14 行有一个。谁能帮我解决这个问题?

<?php
// Define a destination
$targetFolder = '***********'; // Relative to the root
 if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$tempFileExploded = explode($tempFile, ".");
//PROBLEM LINE
$tempFile = $tempFileExploded[0] . date('U') . $tempFileExploded[1];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
$targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name'];
//mkdir(str_replace('//','/',$targetPath), 0777, true);
// Validate the file type
$fileTypes = array('jpg','jpeg','gif','png'); // File extensions
$fileParts = pathinfo($_FILES['Filedata']['name']);
if (in_array($fileParts['extension'],$fileTypes)) {
    move_uploaded_file($tempFile,$targetFile);
    echo '1';
} else {
    echo 'Invalid file type.';
}
}
//$targerfile is the file name
?>

我得到的错误:

解析错误:语法错误,第 14 行代码中出现意外T_STRING解析代码时出错

当你用点爆炸时。 你需要用点扩展。 所以你的代码中缺少点

$tempFile = $tempFileExploded[0] .

日期('U'( ."."。 $tempFileExploded[1];