|
@@ 843-849 (lines=7) @@
|
| 840 |
|
|
| 841 |
|
if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
|
| 842 |
|
|
| 843 |
|
if (get_option($value['id'])) {
|
| 844 |
|
$image_name_arr = explode('/', get_option($value['id']));
|
| 845 |
|
$noimg_name = end($image_name_arr);
|
| 846 |
|
$img_path = $uploads['path'] . '/' . $noimg_name;
|
| 847 |
|
if (file_exists($img_path))
|
| 848 |
|
unlink($img_path);
|
| 849 |
|
}
|
| 850 |
|
|
| 851 |
|
update_option($value['id'], '');
|
| 852 |
|
}
|
|
@@ 871-877 (lines=7) @@
|
| 868 |
|
|
| 869 |
|
$uploads = wp_upload_dir();
|
| 870 |
|
|
| 871 |
|
if (get_option($value['id'])) {
|
| 872 |
|
$image_name_arr = explode('/', get_option($value['id']));
|
| 873 |
|
$noimg_name = end($image_name_arr);
|
| 874 |
|
$img_path = $uploads['path'] . '/' . $noimg_name;
|
| 875 |
|
if (file_exists($img_path))
|
| 876 |
|
unlink($img_path);
|
| 877 |
|
}
|
| 878 |
|
|
| 879 |
|
$upload_overrides = array('test_form' => false);
|
| 880 |
|
$movefile = wp_handle_upload($uplaods, $upload_overrides);
|