PHP 8.1.33
Preview: async-upload.php Size: 4.87 KB
/home/jambtst2015/public_html/cccng.org/wp-admin/async-upload.php

<?php
/**
 * Server-side file upload handler from wp-plupload or other asynchronous upload methods.
 *
 * @package WordPress
 * @subpackage Administration
 */

if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
	define( 'DOING_AJAX', true );
}

if ( ! defined( 'WP_ADMIN' ) ) {
	define( 'WP_ADMIN', true );
}

/** Load WordPress Bootstrap */
require_once dirname( __DIR__ ) . '/wp-load.php';

require_once ABSPATH . 'wp-admin/admin.php';

header( 'Content-Type: text/plain; charset=' . get_option( 'blog_charset' ) );

if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
	require ABSPATH . 'wp-admin/includes/ajax-actions.php';

	send_nosniff_header();
	nocache_headers();

	wp_ajax_upload_attachment();
	die( '0' );
}

if ( ! current_user_can( 'upload_files' ) ) {
	wp_die( __( 'Sorry, you are not allowed to upload files.' ) );
}

// Just fetch the detail form for that attachment.
if ( isset( $_REQUEST['attachment_id'] ) && (int) $_REQUEST['attachment_id'] && $_REQUEST['fetch'] ) {
	$id   = (int) $_REQUEST['attachment_id'];
	$post = get_post( $id );
	if ( 'attachment' !== $post->post_type ) {
		wp_die( __( 'Invalid post type.' ) );
	}

	switch ( $_REQUEST['fetch'] ) {
		case 3:
			?>
			<div class="media-item-wrapper">
				<div class="attachment-details">
					<?php
					$thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true );
					if ( $thumb_url ) {
						echo '<img class="pinkynail" src="' . esc_url( $thumb_url[0] ) . '" alt="" />';
					}

					// Title shouldn't ever be empty, but use filename just in case.
					$file     = get_attached_file( $post->ID );
					$file_url = wp_get_attachment_url( $post->ID );
					$title    = $post->post_title ? $post->post_title : wp_basename( $file );
					?>
					<div class="filename new">
						<span class="media-list-title"><strong><?php echo esc_html( wp_html_excerpt( $title, 60, '&hellip;' ) ); ?></strong></span>
						<span class="media-list-subtitle"><?php echo esc_html( wp_basename( $file ) ); ?></span>
						<div class="attachment-tools">
							<?php
							if ( current_user_can( 'edit_post', $id ) ) {
								echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '">' . _x( 'Edit', 'media item' ) . '</a>';
							} else {
								echo '<span class="edit-attachment">' . _x( 'Success', 'media item' ) . '</span>';
							}
							?>
							<span class="media-item-copy-container copy-to-clipboard-container edit-attachment">
								<button type="button" class="button button-small copy-attachment-url"
									data-clipboard-text="<?php echo esc_url( $file_url ); ?>"
								><?php _e( 'Copy URL to clipboard' ); ?></button>
								<span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
							</span>
						</div>
					</div>
				</div>
			</div>
			<?php
			break;
		case 2:
			add_filter( 'attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2 );
			echo get_media_item(
				$id,
				array(
					'send'   => false,
					'delete' => true,
				)
			);
			break;
		default:
			add_filter( 'attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2 );
			echo get_media_item( $id );
			break;
	}
	exit;
}

check_admin_referer( 'media-form' );

$post_id = 0;
if ( isset( $_REQUEST['post_id'] ) ) {
	$post_id = absint( $_REQUEST['post_id'] );
	if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) {
		$post_id = 0;
	}
}

$id = media_handle_upload( 'async-upload', $post_id );
if ( is_wp_error( $id ) ) {
	$button_unique_id = uniqid( 'dismiss-' );
	$message          = sprintf(
		'%s <strong>%s</strong><br />%s',
		sprintf(
			'<button type="button" id="%s" class="dismiss button-link">%s</button>',
			esc_attr( $button_unique_id ),
			__( 'Dismiss' )
		),
		sprintf(
			/* translators: %s: Name of the file that failed to upload. */
			__( '&#8220;%s&#8221; has failed to upload.' ),
			esc_html( $_FILES['async-upload']['name'] )
		),
		esc_html( $id->get_error_message() )
	);
	wp_admin_notice(
		$message,
		array(
			'additional_classes' => array( 'error-div', 'error' ),
			'paragraph_wrap'     => false,
		)
	);
	echo "<script>jQuery( 'button#{$button_unique_id}' ).on( 'click', function() {jQuery(this).parents('div.media-item').slideUp(200, function(){jQuery(this).remove();})});</script>\n";
	exit;
}

if ( $_REQUEST['short'] ) {
	// Short form response - attachment ID only.
	echo $id;
} else {
	// Long form response - big chunk of HTML.
	$type = $_REQUEST['type'];

	/**
	 * Filters the returned ID of an uploaded attachment.
	 *
	 * The dynamic portion of the hook name, `$type`, refers to the attachment type.
	 *
	 * Possible hook names include:
	 *
	 *  - `async_upload_audio`
	 *  - `async_upload_file`
	 *  - `async_upload_image`
	 *  - `async_upload_video`
	 *
	 * @since 2.5.0
	 *
	 * @param int $id Uploaded attachment ID.
	 */
	echo apply_filters( "async_upload_{$type}", $id );
}

Directory Contents

Dirs: 7 × Files: 96

Name Size Perms Modified Actions
css DIR
- drwxr-xr-x 2024-12-30 07:14:41
Edit Download
images DIR
- drwxr-xr-x 2024-12-30 07:14:41
Edit Download
includes DIR
- drwxr-xr-x 2024-12-31 03:43:34
Edit Download
js DIR
- drwxr-xr-x 2024-12-30 07:14:41
Edit Download
maint DIR
- drwxr-xr-x 2024-12-30 07:14:41
Edit Download
network DIR
- drwxr-xr-x 2025-11-01 12:32:11
Edit Download
user DIR
- drwxr-xr-x 2025-11-01 10:10:57
Edit Download
19.64 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
5.03 KB lrw-r--r-- 2024-07-10 01:13:14
Edit Download
2.77 KB lrw-r--r-- 2024-12-17 21:37:28
Edit Download
479 B lrw-r--r-- 2025-10-08 17:06:31
Edit Download
9.12 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
1.97 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
12.30 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
4.87 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
10.09 KB lrw-r--r-- 2023-09-14 10:24:20
Edit Download
11.35 KB lrw-r--r-- 2024-05-02 03:31:12
Edit Download
5.59 KB lrw-r--r-- 2024-02-27 10:21:12
Edit Download
4.11 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
489 B lrw-r--r-- 2025-10-08 17:06:31
Edit Download
499 B lrw-r--r-- 2025-10-08 17:06:31
Edit Download
10.91 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
14.38 KB lrw-r--r-- 2023-09-18 01:03:18
Edit Download
28.83 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
14.37 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
8.34 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
6.21 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
10.44 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
22.00 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
19.48 KB lrw-r--r-- 2024-12-17 21:37:28
Edit Download
7.33 KB lrw-r--r-- 2024-04-18 05:51:16
Edit Download
59.28 KB lrw-r--r-- 2025-11-04 10:50:15
Edit Download
7.75 KB lrw-r--r-- 2024-04-18 05:51:16
Edit Download
11.02 KB lrw-r--r-- 2024-05-27 06:21:14
Edit Download
4.54 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
959 B lrw-r--r-- 2024-04-10 14:39:00
Edit Download
7.58 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
7.68 KB lrw-r--r-- 2023-09-14 10:24:20
Edit Download
6.80 KB lrw-r--r-- 2022-11-21 00:40:16
Edit Download
17.94 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
934 B lrw-r--r-- 2025-10-08 17:06:31
Edit Download
4.26 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
2.63 KB lrw-r--r-- 2024-06-14 06:20:14
Edit Download
2.89 KB lrw-r--r-- 2024-05-02 03:31:12
Edit Download
2.02 KB lrw-r--r-- 2024-12-17 21:37:28
Edit Download
2.92 KB lrw-r--r-- 2024-12-17 21:37:28
Edit Download
3.18 KB lrw-r--r-- 2023-02-23 21:08:22
Edit Download
3.58 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
819 B lrw-r--r-- 2024-05-02 03:31:12
Edit Download
9.82 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
16.97 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
307 B lrw-r--r-- 2020-02-06 17:03:12
Edit Download
196 B lrw-r--r-- 2020-02-06 17:03:12
Edit Download
4.19 KB lrw-r--r-- 2024-12-17 21:37:28
Edit Download
216 B lrw-r--r-- 2020-02-06 17:03:12
Edit Download
229 B lrw-r--r-- 2024-06-22 21:17:16
Edit Download
215 B lrw-r--r-- 2020-02-06 17:03:12
Edit Download
217 B lrw-r--r-- 2020-02-06 17:03:12
Edit Download
219 B lrw-r--r-- 2020-02-06 17:03:12
Edit Download
215 B lrw-r--r-- 2020-02-06 17:03:12
Edit Download
4.74 KB lrw-r--r-- 2023-09-06 04:56:26
Edit Download
48.26 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
5.39 KB lrw-r--r-- 2024-03-09 09:08:08
Edit Download
15.40 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
21.58 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
621 B lrw-r--r-- 2025-10-08 17:06:31
Edit Download
6.35 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
21.21 KB lrw-r--r-- 2024-03-09 09:08:08
Edit Download
9.95 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
10.03 KB lrw-r--r-- 2024-05-15 03:35:12
Edit Download
9.10 KB lrw-r--r-- 2024-03-09 09:08:08
Edit Download
13.45 KB lrw-r--r-- 2024-12-17 21:37:28
Edit Download
13.66 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
6.96 KB lrw-r--r-- 2024-02-20 17:57:06
Edit Download
30.00 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
2.70 KB lrw-r--r-- 2024-06-15 22:04:14
Edit Download
9.97 KB lrw-r--r-- 2024-06-15 22:04:14
Edit Download
2.34 KB lrw-r--r-- 2024-02-27 07:05:08
Edit Download
3.67 KB lrw-r--r-- 2023-11-23 04:14:24
Edit Download
2.52 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
283 B lrw-r--r-- 2020-02-06 17:03:12
Edit Download
5.71 KB lrw-r--r-- 2024-05-02 03:31:12
Edit Download
17.48 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
11.83 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
3.99 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
10.20 KB lrw-r--r-- 2024-05-02 03:31:12
Edit Download
2.20 KB lrw-r--r-- 2022-06-02 03:44:10
Edit Download
15.59 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
23.37 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
48.12 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
3.43 KB lrw-r--r-- 2023-02-23 21:08:22
Edit Download
45.43 KB lrw-r--r-- 2024-12-17 21:37:28
Edit Download
12.79 KB lrw-r--r-- 2024-01-31 00:53:12
Edit Download
341 B lrw-r--r-- 2020-02-06 17:03:12
Edit Download
6.33 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
14.84 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
39.79 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
24.05 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
23.28 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
4.97 KB lrw-r--r-- 2024-12-17 21:37:28
Edit Download
19.17 KB lrw-r--r-- 2024-01-17 04:01:14
Edit Download
1.09 KB lrw-r--r-- 2022-03-23 05:29:04
Edit Download
65.71 KB lrw-r--r-- 2023-12-04 06:43:23
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).