开发者

Image upload: Unexpected T_VARIABLE [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 9 years ago.

I have the foll开发者_Go百科owing code:

$file_name = $_FILES['uid']['name'];  
$user= 'FILENAME';   
$ext = pathinfo($file_name, PATHINFO_EXTENSION);  
$new_file_name=$user . '.' . $ext;   
$path= "uploads/images/users/".$new_file_name;    
$upload = $_FILES['uid']  
$info = getimagesize( $upload['tmp_name'] );  
if ( $info[2] != IMAGETYPE_JPEG )  
{  
echo "File format is not supported!";  
}  
if ( filesize( $upload[ 'tmp_name' ] ) > 3485760 )  
{  
echo "The filesize is too large!";  
}  
else(move_uploaded_file($_FILES['uid']['tmp_name'], $path))  
{  
echo "Successful<BR/>";  
echo "File Name :".$new_file_name."<BR/>";  
echo "File Size :".$_FILES['uid']['size']."<BR/>";   
echo "File Type :".$_FILES['uid']['type']."<BR/>";  
}  

I am failing to see what the problem is. The error occurs on line 8, which starts with $path.

Could anyone please help me?


else(move_uploaded_file($_FILES['uid']['tmp_name'], $path))

?????????????????????


You forgot a semicolon at:

$upload = $_FILES['uid']

You will need to change it to:

$upload = $_FILES['uid'];

And like Capsule said, you will need to change the else statement to something like this:

elseif(move_uploaded_file($_FILES['uid']['tmp_name'], $path))
{
echo "Successful
";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜