Created
July 7, 2022 09:34
-
-
Save grantalltodavid/341844ca43b091fb391f621f6c112849 to your computer and use it in GitHub Desktop.
WP Wham Checkout Files Upload -- getting uploaded file info programmatically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// which file uploader... i.e. "File Uploader #1" in the settings: | |
$file_uploader_id = 1; | |
// with the WooCommerce $order_id, we can get all the files for $file_uploader_id here: | |
$order_files = get_post_meta( $order_id, '_alg_checkout_files_upload_' . $file_uploader_id, true ); | |
// $order_files will be an array. we can grab a specific file by key here: | |
$order_file = $order_files[ $file_key ]; | |
// once we've picked a single $order_file, we can access it's 'tmp_name' (name it's stored under on the server): | |
$tmp_file_name = alg_get_alg_uploads_dir( 'checkout_files_upload' ) . '/' . $order_file['tmp_name']; | |
// ... or we can get it's "real" name (the original file name) here: | |
$file_name = $order_file['name']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment