本文整理汇总了PHP中wp_handle_upload函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_handle_upload函数的具体用法?PHP wp_handle_upload怎么用?PHP wp_handle_upload使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_handle_upload函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: handle_upload
/**
* Upload
* Ajax callback function
*
* @return string Error or (XML-)response
*/
static function handle_upload()
{
check_admin_referer('rwmb-upload-images_' . $_REQUEST['field_id']);
$post_id = 0;
if (is_numeric($_REQUEST['post_id'])) {
$post_id = (int) $_REQUEST['post_id'];
}
// You can use WP's wp_handle_upload() function:
$file = $_FILES['async-upload'];
$file_attr = wp_handle_upload($file, array('test_form' => true, 'action' => 'plupload_image_upload'));
$attachment = array('guid' => $file_attr['url'], 'post_mime_type' => $file_attr['type'], 'post_title' => preg_replace('/\\.[^.]+$/', '', basename($file['name'])), 'post_content' => '', 'post_status' => 'inherit');
// Adds file as attachment to WordPress
$id = wp_insert_attachment($attachment, $file_attr['file'], $post_id);
if (!is_wp_error($id)) {
wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $file_attr['file']));
// Save file ID in meta field
if (isset($_REQUEST['field_id'])) {
add_post_meta($post_id, $_REQUEST['field_id'], $id, false);
}
$response = new WP_Ajax_Response();
$response->add(array('what' => 'rwmb_image_response', 'data' => self::img_html($id)));
$response->send();
}
exit;
}
开发者ID:scotlanddig,项目名称:bootstrap_basic,代码行数:31,代码来源:plupload-image.php
示例2: bind
/**
* @param array $post
* @param array $files
*/
public function bind(array $post, array $files = array())
{
parent::bind($post, $files);
// Remove the old image.
if (isset($post['ab_remove_logo']) && file_exists(get_option('ab_settings_company_logo_path'))) {
unlink(get_option('ab_settings_company_logo_path'));
update_option('ab_settings_company_logo_path', '');
update_option('ab_settings_company_logo_url', '');
}
// And add new.
if (isset($files['ab_settings_company_logo']) && $files['ab_settings_company_logo']['tmp_name']) {
if (in_array($files['ab_settings_company_logo']['type'], array("image/gif", "image/jpeg", "image/png"))) {
$uploaded = wp_handle_upload($files['ab_settings_company_logo'], array('test_form' => false));
if ($uploaded) {
$editor = wp_get_image_editor($uploaded['file']);
$editor->resize(200, 200);
$editor->save($uploaded['file']);
$this->data['ab_settings_company_logo_path'] = $uploaded['file'];
$this->data['ab_settings_company_logo_url'] = $uploaded['url'];
// Remove old image.
if (file_exists(get_option('ab_settings_company_logo_path'))) {
unlink(get_option('ab_settings_company_logo_path'));
}
}
}
}
}
开发者ID:patrickcurl,项目名称:monks,代码行数:31,代码来源:AB_CompanyForm.php
示例3: process
function process()
{
if (isset($_POST['upload'])) {
check_admin_referer('thesis-favicon-upload', '_wpnonce-thesis-favicon-upload');
#wp
$overrides = array('test_form' => false);
$file = wp_handle_upload($_FILES['import'], $overrides);
#wp
if (isset($file['error'])) {
wp_die($file['error'], __('Favicon Upload Error', 'thesis'));
}
#wp
if ($file['type'] == 'image/x-icon' || $file['type'] == 'image/png') {
$this->url = $file['url'];
$this->save($file['file']);
} else {
$this->error = true;
}
} elseif ($_GET['remove']) {
check_admin_referer('thesis-remove-favicon');
#wp
unset($this->favicon);
delete_option('thesis_favicon');
#wp
$this->removed = true;
}
}
开发者ID:CherylMuniz,项目名称:fashion,代码行数:27,代码来源:favicon.php
示例4: bind
/**
* @param array $post
* @param array $files
*/
public function bind(array $post, array $files = array())
{
parent::bind($post, $files);
// remove the old image
if (isset($post['ab_remove_logo']) && file_exists(get_option('ab_settings_company_logo_path'))) {
unlink(get_option('ab_settings_company_logo_path'));
update_option('ab_settings_company_logo_path', '');
update_option('ab_settings_company_logo_url', '');
}
// and add new
if (isset($files['ab_settings_company_logo']) && $files['ab_settings_company_logo']['tmp_name']) {
if (in_array($files['ab_settings_company_logo']['type'], array("image/gif", "image/jpeg", "image/png"))) {
$movefile = wp_handle_upload($files['ab_settings_company_logo'], array('test_form' => false));
if ($movefile) {
$imageResize = new AB_ImageResize($movefile['file']);
$imageResize->resizeImage(150, 150);
$imageResize->saveImage($movefile['file']);
$this->data['ab_settings_company_logo_path'] = $movefile['file'];
$this->data['ab_settings_company_logo_url'] = $movefile['url'];
// remove the old image
if (file_exists(get_option('ab_settings_company_logo_path'))) {
unlink(get_option('ab_settings_company_logo_path'));
}
}
}
}
}
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:31,代码来源:AB_CompanyForm.php
示例5: wppb_image_upload_form_check
/**
* Security checks for image upload form
* @since 0.1
*/
function wppb_image_upload_form_check()
{
// Check nonce - security protection to prevent creation and deletion of files by untrusted users
if (!empty($_POST) and check_admin_referer('wppb_upload_image', 'image')) {
// Upload file
$data = $_FILES['upload_file'];
if ('' != $data['name']) {
$ext = substr(strrchr($data['name'], '.'), 1);
// Grab extension
$ext = strtolower($ext);
// Convert extension to lower case
// Spit an error out when not an image - would be better to send admin notice instead
if ($ext != 'jpeg' and $ext != 'jpg' and $ext != 'gif' and $ext != 'png') {
die('Only jpg, gif or png files are allowed to be uploaded!');
// Kill execution so they get to see the error
}
// Save file to disk
add_filter('upload_dir', 'wppb_image_uploads_folder');
$overrides = array('test_form' => false);
$file = wp_handle_upload($data, $overrides);
remove_filter('upload_dir', 'wppb_image_uploads_folder');
}
// Delete file
if (isset($_POST['delete_file'])) {
unlink(wppb_storage_folder('images') . '/' . $_POST['delete_file']);
}
}
}
开发者ID:pemiu01,项目名称:wppaintbrush,代码行数:32,代码来源:images.php
示例6: nev_admin_upload_file
function nev_admin_upload_file()
{
if (!function_exists('wp_handle_upload')) {
require_once ABSPATH . 'wp_admin/includes/file.php';
}
if (empty($_FILES['file_path'])) {
return;
}
$uploadedFile = $_FILES['file_path'];
$uploaded_overrides = array('test_form' => false);
$moveFile = wp_handle_upload($uploadedFile, $uploaded_overrides);
if (!empty($moveFile['error'])) {
echo $moveFile['error'];
return;
}
if ($moveFile) {
$wp_filetype = $moveFile['type'];
$filename = $moveFile['file'];
$wp_upload_dir = wp_upload_dir();
$attachment = array('guid' => $wp_upload_dir['url'] . '/' . basename($filename), 'post_mime_type' => $wp_filetype, 'post_title' => preg_replace('/\\.[^.]+$/', '', basename($filename)), 'post_content' => '', 'post_status' => 'inherit');
$attach_id = wp_insert_attachment($attachment, $filename);
$file_path = get_attached_file($attach_id);
update_option("nev-file_path", $file_path);
echo "File uploaded to " . $file_path;
} else {
echo "Failed!";
}
}
开发者ID:pmarki,项目名称:next_events,代码行数:28,代码来源:nev-admin.php
示例7: epanel_ajax_callback
function epanel_ajax_callback() {
global $wpdb; // this is how you get access to the database
if($_POST['type']){
$save_type = $_POST['type'];
}else $save_type = null;
//Uploads
if($save_type == 'upload'){
$clickedID = $_POST['data']; // Acts as the name
$filename = $_FILES[$clickedID];
$filename['name'] = preg_replace('/[^a-zA-Z0-9._\-]/', '', $filename['name']);
$override['test_form'] = false;
$override['action'] = 'wp_handle_upload';
$uploaded_file = wp_handle_upload($filename,$override);
$upload_tracking[] = $clickedID;
epanel_update_option( $clickedID , $uploaded_file['url'] );
if(!empty($uploaded_file['error'])) {echo 'Upload Error: ' . $uploaded_file['error']; }
else { echo $uploaded_file['url']; } // Is the Response
}
elseif($save_type == 'image_reset'){
$id = $_POST['data']; // Acts as the name
epanel_update_option($id, null);
}
die();
}
开发者ID:robbiespire,项目名称:paQui,代码行数:35,代码来源:actions.admin.php
示例8: charitable_plupload_image_upload
/**
* Upload an image via plupload.
*
* @return
*/
function charitable_plupload_image_upload()
{
$post_id = (int) filter_input(INPUT_POST, 'post_id', FILTER_SANITIZE_NUMBER_INT);
$field_id = (string) filter_input(INPUT_POST, 'field_id');
check_ajax_referer('charitable-upload-images-' . $field_id);
$file = $_FILES['async-upload'];
$file_attr = wp_handle_upload($file, array('test_form' => false));
if (isset($file_attr['error'])) {
wp_send_json_error($file_attr);
}
$attachment = array('guid' => $file_attr['url'], 'post_mime_type' => $file_attr['type'], 'post_title' => preg_replace('/\\.[^.]+$/', '', basename($file['name'])), 'post_content' => '', 'post_status' => 'inherit');
/**
* Insert the file as an attachment.
*/
$attachment_id = wp_insert_attachment($attachment, $file_attr['file'], $post_id);
if (is_wp_error($attachment_id)) {
wp_send_json_error();
}
wp_update_attachment_metadata($attachment_id, wp_generate_attachment_metadata($attachment_id, $file_attr['file']));
$size = (string) filter_input(INPUT_POST, 'size');
$max_uploads = (int) filter_input(INPUT_POST, 'max_uploads', FILTER_SANITIZE_NUMBER_INT);
if (!$size) {
$size = 'thumbnail';
}
ob_start();
charitable_template('form-fields/picture-preview.php', array('image' => $attachment_id, 'field' => array('key' => $field_id, 'size' => $size, 'max_uploads' => $max_uploads)));
wp_send_json_success(ob_get_clean());
}
开发者ID:helgatheviking,项目名称:Charitable,代码行数:33,代码来源:charitable-ajax-functions.php
示例9: wpua_avatar_upload
public function wpua_avatar_upload($file)
{
$filetype = wp_check_filetype($file->name);
$media_upload = array();
$media_upload['file'] = array('name' => $file->name, 'type' => $filetype['type'], 'tmp_name' => $file->path, 'error' => 0, 'size' => filesize($file->path));
$media_file = wp_handle_upload($media_upload['file'], array('test_form' => false, 'test_upload' => false, 'action' => 'custom_action'));
if ($media_file['file']) {
$url = $media_file['url'];
$filepath = $media_file['file'];
if ($image_meta = @wp_read_image_metadata($filepath)) {
if (trim($image_meta['title']) && !is_numeric(sanitize_title($image_meta['title']))) {
$title = $image_meta['title'];
}
}
$attachment = array('guid' => $url, 'post_mime_type' => $filetype['type'], 'post_title' => $title);
$attachment_id = wp_insert_attachment($attachment, $filepath);
if (!is_wp_error($attachment_id)) {
$this->delete_attachment_by_user($this->user_id);
wp_update_attachment_metadata($attachment_id, wp_generate_attachment_metadata($attachment_id, $filepath));
update_post_meta($attachment_id, '_wp_attachment_wp_user_avatar', $this->user_id);
$arr = wp_get_attachment_image_src($attachment_id, 'full');
$this->avatar_url = $arr[0];
$this->avatar_filename = basename($filepath);
$this->resource = $attachment_id;
$saved = $this->save();
if (!$saved) {
$this->delete_attachment($attachment_id);
return $saved;
}
return $saved;
}
} else {
return WP_Error('file_upload_problem', __("Media avatar could't uploading please check you have right permission for uploads folder.", 'wp-user-avatar-pro'));
}
}
开发者ID:andyUA,项目名称:kabmin-new,代码行数:35,代码来源:class-wpua-media-storage.php
示例10: handle_upload
/**
* Process the upload.
*
* @since 1.0.0
*/
public function handle_upload()
{
// Make sure all files are allowed
if (!$this->check_file_type($_FILES['qqfile']['name'])) {
return array('success' => false);
}
// if()
// Get size and name
if (!function_exists('wp_handle_upload')) {
require_once ABSPATH . 'wp-admin/includes/file.php';
}
$uploadedfile = $_FILES['qqfile'];
$upload_overrides = array('test_form' => false);
$movefile = wp_handle_upload($uploadedfile, $upload_overrides);
if ($movefile) {
$wp_upload_dir = wp_upload_dir();
$filename = str_replace($wp_upload_dir['url'] . '/', '', $movefile['url']);
$attachment = $this->add_attachment($movefile['url'], $movefile['file']);
$feat_image = wp_get_attachment_url($attachment);
$img = vt_resize('', $feat_image, 200, 150, true);
return array('success' => $movefile, 'attachmentId' => $attachment, 'attachment_url' => $img['url']);
} else {
return array('success' => false);
}
return array('success' => false);
}
开发者ID:narendra-addweb,项目名称:MyImmoPix,代码行数:31,代码来源:class-wpmfu-file-upload-handler.php
示例11: atp_plupload_action
function atp_plupload_action()
{
// check ajax noonce
$imgid = $_POST["imgid"];
check_ajax_referer($imgid . 'pluploadan');
$post_id = isset($_POST['post_id']) ? intval($_POST['post_id']) : 0;
// handle file upload
$filename = $_FILES[$imgid . 'async-upload']['name'];
$status = wp_handle_upload($_FILES[$imgid . 'async-upload'], array('test_form' => true, 'action' => 'plupload_action'));
if (!isset($status['file'])) {
continue;
}
$file_name = $status['file'];
$name_parts = pathinfo($file_name);
$name = trim(substr($filename, 0, -(1 + strlen($name_parts['extension']))));
$attachment = array('post_mime_type' => $status['type'], 'guid' => $status['url'], 'post_parent' => $post_id, 'post_title' => $name, 'post_content' => '');
$id = wp_insert_attachment($attachment, $file_name, $post_id);
if (!is_wp_error($id)) {
wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $file_name));
$new[] = $id;
}
// send the uploaded file url in response
$upload_path = wp_get_attachment_url($id, true);
if (preg_match_all('/[^\\?]+\\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $upload_path, $matches)) {
$image_attributes = wp_get_attachment_image_src($id, 'thumbnail');
// returns an array
$uplaod_url = $image_attributes[0];
} else {
$uplaod_url = $upload_path;
}
$imagetest = array('url' => $status['url'], 'link' => get_edit_post_link($id), 'audioid' => $id, 'name' => $name, 'img' => $uplaod_url);
echo json_encode($imagetest);
//print_r ($imagetest);
exit;
}
开发者ID:pryspry,项目名称:MusicPlay,代码行数:35,代码来源:meta-generator.php
示例12: theme_add_admin
function theme_add_admin()
{
global $themename, $shortname, $options;
if ($_GET['page'] == basename(__FILE__)) {
if ('save' == $_REQUEST['action']) {
foreach ($options as $value) {
if ($value['type'] == 'upload') {
$file_uploaded = $_FILES[$value['id']];
if ($file_uploaded && $file_uploaded['error'] == 0) {
$overrides = array('test_form' => false);
$file = wp_handle_upload($file_uploaded, $overrides);
update_option($value['id'], $file['url']);
}
} elseif (isset($_REQUEST[$value['id']])) {
update_option($value['id'], $_REQUEST[$value['id']]);
}
}
header("Location: themes.php?page=theme-options.php&saved=true");
die;
} else {
if ('reset' == $_REQUEST['action']) {
foreach ($options as $value) {
delete_option($value['id']);
}
header("Location: themes.php?page=theme-options.php&reset=true");
die;
}
}
}
add_theme_page($themename . " Options", "" . $themename . " Options", 'edit_themes', basename(__FILE__), 'theme_admin');
}
开发者ID:48Web,项目名称:LaunchChimp-Parent,代码行数:31,代码来源:theme-options.php
示例13: handle_upload
/**
* Upload
* Ajax callback function
*
* @return error or (XML-)response
*/
static function handle_upload()
{
header('Content-Type: text/html; charset=UTF-8');
if (!defined('DOING_AJAX')) {
define('DOING_AJAX', true);
}
check_ajax_referer('plupload_image');
$post_id = 0;
if (is_numeric($_REQUEST['post_id'])) {
$post_id = (int) $_REQUEST['post_id'];
}
// you can use WP's wp_handle_upload() function:
$file = $_FILES['async-upload'];
$file_attr = wp_handle_upload($file, array('test_form' => true, 'action' => 'plupload_image_upload'));
$attachment = array('post_mime_type' => $file_attr['type'], 'post_title' => preg_replace('/\\.[^.]+$/', '', basename($file['name'])), 'post_content' => '', 'post_status' => 'inherit');
// Adds file as attachment to WordPress
$id = wp_insert_attachment($attachment, $file_attr['file'], $post_id);
if (!is_wp_error($id)) {
$response = new WP_Ajax_Response();
wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $file_attr['file']));
if (isset($_REQUEST['field_id'])) {
// Save file ID in meta field
add_post_meta($post_id, $_REQUEST['field_id'], $id, false);
}
$response->add(array('what' => 'rwmb_image_response', 'data' => self::img_html($id)));
$response->send();
}
// faster than die();
exit;
}
开发者ID:hunghoang179,项目名称:sitenews,代码行数:36,代码来源:plupload-image.php
示例14: cptImages_savefile
function cptImages_savefile($file, $name, $slug = false, $parent_post_id = 0, $content = '', $attachData = array())
{
if (empty($file)) {
return false;
}
if (!function_exists('wp_handle_upload')) {
require_once ABSPATH . 'wp-admin/includes/file.php';
}
$upload_overrides = array('test_form' => false);
$movefile = wp_handle_upload($file, $upload_overrides);
$name = 'wp-cpt-images image for ' . $name;
if ($movefile && !isset($movefile['error'])) {
$wp_filetype = $movefile['type'];
$filename = $movefile['file'];
$wp_upload_dir = wp_upload_dir();
$attachment = array('guid' => $wp_upload_dir['url'] . '/' . basename($filename), 'post_mime_type' => $wp_filetype, 'post_title' => $name, 'post_content' => $content, 'post_status' => 'inherit');
$attach_id = wp_insert_attachment($attachment, $filename, $parent_post_id);
require_once ABSPATH . 'wp-admin/includes/image.php';
add_post_meta($attach_id, 'wp-cpt-image-attachment', $slug);
foreach ($attachData as $key => $val) {
add_post_meta($attach_id, $key, $val);
}
update_cpt_connection_link($slug, $attach_id);
}
return $attach_id;
}
开发者ID:social-ink,项目名称:wp-cpt-images,代码行数:26,代码来源:core.php
示例15: wp_import_handle_upload
/**
* Handle importer uploading and add attachment.
*
* @since 2.0.0
*
* @return array Uploaded file's details on success, error message on failure
*/
function wp_import_handle_upload() {
if ( !isset($_FILES['import']) ) {
$file['error'] = __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.' );
return $file;
}
$overrides = array( 'test_form' => false, 'test_type' => false );
$_FILES['import']['name'] .= '.txt';
$file = wp_handle_upload( $_FILES['import'], $overrides );
if ( isset( $file['error'] ) )
return $file;
$url = $file['url'];
$type = $file['type'];
$file = $file['file'];
$filename = basename( $file );
// Construct the object array
$object = array( 'post_title' => $filename,
'post_content' => $url,
'post_mime_type' => $type,
'guid' => $url,
'context' => 'import',
'post_status' => 'private'
);
// Save the data
$id = wp_insert_attachment( $object, $file );
// schedule a cleanup for one day from now in case of failed import or missing wp_import_cleanup() call
wp_schedule_single_event( time() + DAY_IN_SECONDS, 'importer_scheduled_cleanup', array( $id ) );
return array( 'file' => $file, 'id' => $id );
}
开发者ID:pauEscarcia,项目名称:AIMM,代码行数:42,代码来源:IMPORT.PHP
示例16: insert_panel_upload
/**
* insert_panel_upload function.
*
* @access public
* @return void
*/
public function insert_panel_upload()
{
check_ajax_referer('file-upload');
$status = wp_handle_upload($_FILES['async-upload'], array('test_form' => false));
echo $status['url'];
die;
}
开发者ID:garysims,项目名称:bbmp3downloader,代码行数:13,代码来源:class-dlm-ajax-handler.php
示例17: setImage
/**
* Set image
*
* @param string $keyImg
* Key from the image
* @param file $imgFile
* The image
* @throws Exception
* @return void|string
*/
protected function setImage($keyImg, $imgFile)
{
// If it's false or null we have to remove it from the server
if (!$imgFile || is_null($imgFile)) {
return $this->removeImage($keyImg);
}
if (strpos($imgFile['name'], '.php') !== false) {
throw new Exception('For security reasons, the extension ".php" cannot be in your file name.');
}
$avatar = wp_handle_upload($_FILES[$keyImg], array('mimes' => array('jpg|jpeg|jpe' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png'), 'test_form' => false, 'unique_filename_callback' => function ($dir, $name, $ext) use($keyImg) {
$name = $base_name = sanitize_file_name($this->user_login . '_' . $keyImg);
$number = 1;
while (file_exists($dir . "/{$name}{$ext}")) {
$name = $base_name . '_' . $number;
$number++;
}
return $name . $ext;
}));
// Remove the last image
$this->removeImage($keyImg);
$metaValue = array();
$url_or_media_id = $avatar['url'];
// Set the new image
if (is_int($url_or_media_id)) {
$metaValue['media_id'] = $url_or_media_id;
$url_or_media_id = wp_get_attachment_url($url_or_media_id);
}
$metaValue['full'] = $url_or_media_id;
return update_user_meta($this->ID, $keyImg, $metaValue);
}
开发者ID:pavoltanuska,项目名称:knob-mvc,代码行数:40,代码来源:Image.php
示例18: validate_setting
function validate_setting($plugin_options) {
$keys = array_keys($_FILES);
$i = 0;
foreach ( $_FILES as $image ) {
// if a files was upload
if ($image['size']) {
// if it is an image
if ( preg_match('/(jpg|jpeg|png|gif)$/', $image['type']) ) {
$override = array('test_form' => false);
// save the file, and store an array, containing its location in $file
$file = wp_handle_upload( $image, $override );
$plugin_options[$keys[$i]] = $file['url'];
} else {
// Not an image.
$options = get_option('plugin_options');
$plugin_options[$keys[$i]] = $options[$logo];
// Die and let the user know that they made a mistake.
wp_die('No image was uploaded.');
}
} else { // else, the user didn't upload a file, retain the image that's already on file.
$options = get_option('plugin_options');
$plugin_options[$keys[$i]] = $options[$keys[$i]];
}
$i++;
}
return $plugin_options;
}
开发者ID:rickard2,项目名称:0x539.se-theme,代码行数:27,代码来源:admin-menu.php
示例19: file_upload_example_options_page
function file_upload_example_options_page()
{
if (empty($_FILES)) {
?>
<div>
<h2>Upload a file here</h2>
<form action="" method="post" enctype="multipart/form-data">
<?php
wp_nonce_field('csv-import');
?>
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="save" value="save">
</form>
</div>
<?php
} else {
if (!function_exists('wp_handle_upload')) {
require_once ABSPATH . 'wp-admin/includes/file.php';
}
$uploadedfile = $_FILES['file'];
$upload_overrides = array('test_form' => false);
$movefile = wp_handle_upload($uploadedfile, $upload_overrides);
if ($movefile) {
echo "File is valid, and was successfully uploaded.\n";
var_dump($movefile);
// here you can do some stuff with this
} else {
echo "Possible file upload attack!\n";
}
}
}
开发者ID:aamirs332,项目名称:wordpress-demos,代码行数:33,代码来源:file-upload-example.php
示例20: nebula_upload_to_media_library
function nebula_upload_to_media_library($filepath)
{
if (!file_exists($filepath) || strlen(trim($filepath)) == 0) {
return;
}
$result = wp_handle_upload($filepath);
}
开发者ID:KevinFairbanks,项目名称:Nebula,代码行数:7,代码来源:nebula_inprogress.php
注:本文中的wp_handle_upload函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论