/** * Get the contents of an uploaded file. * (Returns false if there was an issue.) * * @param string $input_name The name of the file input field on the submission form * * @return mixed|false The contents of the file, or false on failure. * @deprecated 2.3 */ function get_uploaded_file($input_name) { elgg_deprecated_notice(__FUNCTION__ . ' has been deprecated and will be removed', '2.3'); $inputs = elgg_get_uploaded_files($input_name); $input = array_shift($inputs); if (!$input || !$input->isValid()) { return false; } return file_get_contents($input->getPathname()); }
* * @package ElggFile */ // Get variables $title = htmlspecialchars(get_input('title', '', false), ENT_QUOTES, 'UTF-8'); $desc = get_input("description"); $access_id = (int) get_input("access_id"); $container_guid = (int) get_input('container_guid', 0); $guid = (int) get_input('file_guid'); $tags = get_input("tags"); if ($container_guid == 0) { $container_guid = elgg_get_logged_in_user_guid(); } elgg_make_sticky_form('file'); // check if upload attempted and failed $uploaded_files = elgg_get_uploaded_files('upload'); $uploaded_file = array_shift($uploaded_files); if ($uploaded_file && !$uploaded_file->isValid()) { $error = elgg_get_friendly_upload_error($uploaded_file->getError()); register_error($error); forward(REFERER); } // check whether this is a new file or an edit $new_file = true; if ($guid > 0) { $new_file = false; } if ($new_file) { $file = new ElggFile(); $file->subtype = "file"; } else {