我已使用Web脚本将文件上传到我的Web服务器.所以,如果我需要获得它的大小,我怎么能通过PHP获得它?
<?php
session_start();
define('incall', true);
include("connection.php");
if(!@include_once('config.php'))
{
header('HTTP/1.0 404 Not Found');
exit;
}
$to=$_POST['to'];
$message = str_replace('{link}', $download_path.$_POST['filename'].'.mp3', $email_body);
echo $fname." size";
die;
$fname=$download_path.$_POST['filename'].'.mp3';
$headers = "From: ".$_POST['from'];
$subject=$_POST['subject'];
$date=date("Y/m/d");
$time=date('h:i:s A');
$size=filesize('$fname');
$username=$_SESSION['username'];
if(mail($to, $subject, $message, $headers))
{
$query=mysql_query("INSERT INTO sent values('$username', '$to','$date', '$time', '.mp3', '$size' )");
header("location:mailsent.php?");
}
else
exit('Error! VoiceMail not be send.');
?>
Run Code Online (Sandbox Code Playgroud)
我正在收到电子邮件中的下载链接.但是$ fname仍然不存在.我想知道为什么 ??