我正在使用Flash和PHP创建JPG。我让Flash和PHP在本地主机服务器上按预期工作。当我上传到服务器时,我得到以下错误:
分析错误:语法错误,中出现意外的":"/home/calosrg/public_html/mysubdomain/image.php联机6
代码:
<?PHP
date_default_timezone_set('America/Los_Angeles');
$targetFilename = date(‘YmdHis’).’_’.mt_rand().’.jpg’;
$serverpath = ‘http://www.mysubdomain.myserver.com';
$directoryPath = ‘/newimagesfolder/‘;
$target_path = $_SERVER['DOCUMENT_ROOT'].$directoryPath.$targetFilename;
if ( move_uploaded_file( $_FILES[ 'userfile' ][ 'tmp_name' ], $target_path ) )
{
echo $serverpath.$directoryPath.$targetFilename;
}
else
{
echo "error";
}
?>
提前感谢您抽出时间。
您使用了错误的引号。‘
应该是普通的单引号'
。奇怪的是,在这个代码的其他地方,它们都是正确的。在我看来,这可能是一个剪切粘贴错误。
您已经使用了‘
,您需要使用单或双'
'或"
引号
$targetFilename = date("YmdHis")."_".mt_rand().".jpg";
$serverpath = "http://www.mysubdomain.myserver.com";
$directoryPath = "/newimagesfolder/";