Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Answered by R. SR. S on stackoverflowstackoverflow

In your saveAction of you controller you need to check if the delete image checkbox is check.

Eg.

if (isset($_FILES['checkcsv']['name']) && $_FILES['checkcsv']['name'] != '') {
    try {
        ...
        $uploader->save($path, $logoName);
        
        save path to database

    } catch (Exception $e) {
 
    }
}
else if((isset($data['banner']['delete']) && $data['banner']['delete'] == 1)){
    
    //set path to null and save to database
    $data['banner'] = '';

    //can also delete file from fs
    unlink(Mage::getBaseDir('media') . DS . $data['banner']['value']);
}

Answered by R. S on stackoverflow

In your saveAction of you controller you need to check if the delete image checkbox is check.

Eg.

if (isset($_FILES['checkcsv']['name']) && $_FILES['checkcsv']['name'] != '') {
    try {
        ...
        $uploader->save($path, $logoName);
        
        save path to database

    } catch (Exception $e) {
 
    }
}
else if((isset($data['banner']['delete']) && $data['banner']['delete'] == 1)){
    
    //set path to null and save to database
    $data['banner'] = '';

    //can also delete file from fs
    unlink(Mage::getBaseDir('media') . DS . $data['banner']['value']);
}

Answered by R. S on stackoverflow

In your saveAction of you controller you need to check if the delete image checkbox is check.

Eg.

if (isset($_FILES['checkcsv']['name']) && $_FILES['checkcsv']['name'] != '') {
    try {
        ...
        $uploader->save($path, $logoName);
        
        save path to database

    } catch (Exception $e) {
 
    }
}
else if((isset($data['banner']['delete']) && $data['banner']['delete'] == 1)){
    
    //set path to null and save to database
    $data['banner'] = '';

    //can also delete file from fs
    unlink(Mage::getBaseDir('media') . DS . $data['banner']['value']);
}
Source Link
Mohammad Faisal
  • 1.1k
  • 2
  • 15
  • 36

Answered by R. S on stackoverflow

In your saveAction of you controller you need to check if the delete image checkbox is check.

Eg.

if (isset($_FILES['checkcsv']['name']) && $_FILES['checkcsv']['name'] != '') {
    try {
        ...
        $uploader->save($path, $logoName);
        
        save path to database

    } catch (Exception $e) {
 
    }
}
else if((isset($data['banner']['delete']) && $data['banner']['delete'] == 1)){
    
    //set path to null and save to database
    $data['banner'] = '';

    //can also delete file from fs
    unlink(Mage::getBaseDir('media') . DS . $data['banner']['value']);
}