https://unirem.mx/image/1452/
10 | 0

by geracar
Uploaded in

Debes iniciar sesión para subir archivos.

"; } ob_start(); // Procesar subida if (isset($_POST['unirem_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 && !isset($movefile['error'])) { $filetype = wp_check_filetype($movefile['file'], null); $attachment = array( 'post_mime_type' => $filetype['type'], 'post_title' => sanitize_file_name($uploadedfile['name']), 'post_content' => '', 'post_status' => 'inherit' ); $attach_id = wp_insert_attachment($attachment, $movefile['file']); require_once(ABSPATH . 'wp-admin/includes/image.php'); $attach_data = wp_generate_attachment_metadata($attach_id, $movefile['file']); wp_update_attachment_metadata($attach_id, $attach_data); echo "

Archivo subido correctamente.

"; } else { echo "

Error al subir archivo.

"; } } ?>
"; return ob_get_clean(); }

|

More by the same author