0

I have a php system that will sign and zip a passbook pass. I need it to check for the file thumbnail.png and if it does not exist to make a directory with the variable $idnumber and then rename the file and move it over into the new folder. This Is My Code:

...

if (!file_exists('images/'.$idnumber.'/thumbnail.png')) {
mkdir("images/$idnumber", 0777);
rename("images/$idnumber.png", "images/$idnumber/thumbnail.png")
}

$pass->addFile('images/icon.png');
$pass->addFile('images/icon@2x.png');
$pass->addFile('images/logo.png');
$pass->addFile('images/'.$idnumber.'.png');
if($pass->checkError($error) == true) {
exit('An error occured: '.$error);
}
...

I Am Running This Code On A XAMPP LocalServer, but it is not creating the directory or renaming file.

What Am I Doing Wrong?

  • Try `mkdir("images/".$idnumber, 0777);` and `rename("images/". $idnumber.png, "images/" .$idnumber. "/thumbnail.png");` see if that works. – Funk Forty Niner Sep 05 '13 at 19:16
  • You also have a missing semi-colon at the end of `rename("images/$idnumber.png", "images/$idnumber/thumbnail.png")` try just `rename("images/$idnumber.png", "images/$idnumber/thumbnail.png");` see if that alone fixes your problem. – Funk Forty Niner Sep 05 '13 at 19:17

0 Answers0