Created
December 11, 2019 18:00
-
-
Save hmowais/bc192d4d058feb00e4193d34b0890a75 to your computer and use it in GitHub Desktop.
file exist in WordPress upload Folder
This file contains hidden or 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
| <?php | |
| global $product; | |
| $upload_dir = wp_upload_dir(); | |
| $file_location = $upload_dir['basedir'].'/'."acf_attached_file".'/'.$product->get_slug().'.pdf'; | |
| if(file_exists($file_location)) { | |
| echo "file exist"; | |
| } | |
| else { | |
| echo "not exist"; | |
| } | |
| //or | |
| if(file_exists($file_location)) : | |
| echo "file exist"; | |
| else : | |
| echo "not exist"; | |
| endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment