diff --git a/includes/admin/meta-boxes/class-wc-meta-box-product-data.php b/includes/admin/meta-boxes/class-wc-meta-box-product-data.php
index ff9cef5cb6d..705f05d79ad 100644
--- a/includes/admin/meta-boxes/class-wc-meta-box-product-data.php
+++ b/includes/admin/meta-boxes/class-wc-meta-box-product-data.php
@@ -1281,9 +1281,13 @@ class WC_Meta_Box_Product_Data {
}
// Validate the file exists
- if ( 'relative' === $file_is && ! apply_filters( 'woocommerce_downloadable_file_exists', file_exists( $file_url ), $file_url ) ) {
- WC_Admin_Meta_Boxes::add_error( sprintf( __( 'The downloadable file %s cannot be used as it does not exist on the server.', 'woocommerce' ), '' . $file_url . '
' ) );
- continue;
+ if ( 'relative' === $file_is ) {
+ $_file_exists = '..' === substr( $file_url, 0, 2 ) ? file_exists( realpath( ABSPATH . $file_url ) ) : file_exists( $file_url );
+
+ if ( ! apply_filters( 'woocommerce_downloadable_file_exists', $_file_exists, $file_url ) ) {
+ WC_Admin_Meta_Boxes::add_error( sprintf( __( 'The downloadable file %s cannot be used as it does not exist on the server.', 'woocommerce' ), '' . $file_url . '
' ) );
+ continue;
+ }
}
$files[ $file_hash ] = array(