Here’s my code first of all:
/* Make directory if not existing */
$directory = "appicons/$artistid/$appid/";
if (!is_dir ($directory))
{
$mode = 0777;
mkdir($directory, $mode, true);
}
/* Resize Icon */
include('appicons.php');
if(file_exists(''. $artistid . '-' . $appid . '.png')){
end(&$appicon);
}else{
$appicon = new SimpleImage();
$appicon->load($icon);
$appicon->resizeToWidth(128);
$appicon->save(''. $artistid . '-' . $appid . '.png');
}
$appicon saves a file to the root directory of my website as $appid-$artistid.png. I’d like that file to be moved to the correct directory (which takes the format /appicons/$appid/$artistid/.
I’ve looked at move_uploaded_file but I’m not sure how to implement it, or if that is the right function I should be using. I believe I should be editing $appicon->save(''. $artistid . '-' . $appid . '.png'); but I’m unsure what to do…
I think what you are looking for is: