|
@@ 823-829 (lines=7) @@
|
| 820 |
|
|
| 821 |
|
if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
|
| 822 |
|
|
| 823 |
|
if (get_option($value['id'])) {
|
| 824 |
|
$image_name_arr = explode('/', get_option($value['id']));
|
| 825 |
|
$noimg_name = end($image_name_arr);
|
| 826 |
|
$img_path = $uploads['path'] . '/' . $noimg_name;
|
| 827 |
|
if (file_exists($img_path))
|
| 828 |
|
unlink($img_path);
|
| 829 |
|
}
|
| 830 |
|
|
| 831 |
|
update_option($value['id'], '');
|
| 832 |
|
}
|
|
@@ 851-857 (lines=7) @@
|
| 848 |
|
|
| 849 |
|
$uploads = wp_upload_dir();
|
| 850 |
|
|
| 851 |
|
if (get_option($value['id'])) {
|
| 852 |
|
$image_name_arr = explode('/', get_option($value['id']));
|
| 853 |
|
$noimg_name = end($image_name_arr);
|
| 854 |
|
$img_path = $uploads['path'] . '/' . $noimg_name;
|
| 855 |
|
if (file_exists($img_path))
|
| 856 |
|
unlink($img_path);
|
| 857 |
|
}
|
| 858 |
|
|
| 859 |
|
$upload_overrides = array('test_form' => false);
|
| 860 |
|
$movefile = wp_handle_upload($uplaods, $upload_overrides);
|