/** * Processes the uploaded files in the request. Most of the legwork is handled in {@link KickAssetUtil} * * @return SS_HTTPResponse */ public function upload(SS_HTTPRequest $r) { // We don't want anyone uploading to the root assets folder.. if (!$this->defaultFolder) { $this->defaultFolder = Folder::findOrMake("Uploads"); } $response = KickAssetUtil::handle_upload($r, $this->defaultFolder); if (empty($response)) { return new SS_HTTPResponse("File did not upload", 500); } if (is_array($response)) { return new SS_HTTPResponse(implode(',', $response), 200); } return new SS_HTTPResponse("Error: " . $response, 500); }
/** * Handles the uploading of files. Most of the legwork is done in {@link KickAssetUtil} * * @param SS_HTTPRequest * @return SS_HTTPResponse */ public function upload(SS_HTTPRequest $r) { $response = KickAssetUtil::handle_upload($r, $this->currentFolder); if (is_array($response)) { return new SS_HTTPResponse("OK"); } return $response; }