Click here to Skip to main content
15,867,771 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
$oldname = ['tmp_name'];
$newname =  $_SESSION['username']; '.' + $imageFileType
if (rename($oldname, $newname)) { // syntax error, unexpected T_IF
$message = sprintf(
  '',
  $oldname,
  $newname
);
} else {
$message = sprintf(
  '',
  $oldname
);
}

if (rename($oldname, $newname)) { has syntax error unexpected T_IF

What I have tried:

searching from stackoverflow and adding stuff and then removing
Posted
Updated 5-Feb-22 3:16am
Comments
Richard MacCutchan 5-Feb-22 10:09am    
You need to read your code more carefully when you get these errors. You are missing a semi-colon again.

1 solution

PHP
$oldname = ['tmp_name'];
$newname =  $_SESSION['username']; '.' + $imageFileType // What about a ';' at the end of this line ?
if (rename($oldname, $newname)) {
$message = sprintf(
  '',
  $oldname,
  $newname
);
} else {
$message = sprintf(
  '',
  $oldname
);
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900