- if ($_FILES['app_icon']['error'] ==
- UPLOAD_ERR_OK) {
-
- try {
- $imagefile = ImageFile::fromUpload('app_icon');
- } catch (Exception $e) {
- common_debug("damn that sucks");
- $this->showForm($e->getMessage());
- return;
- }
-
- $filename = Avatar::filename($app->id,
- image_type_to_extension($imagefile->type),
- null,
- 'oauth-app-icon-'.common_timestamp());
-
- $filepath = Avatar::path($filename);
-
- move_uploaded_file($imagefile->filepath, $filepath);
-
- $app->setOriginal($filename);
- }