0

I'm using rest services with a custom resource on node update, i want to build the correct variable node structure to delete one of the files on a file image multiple fields. I removed the file element from the form_state['values'] but isn't working. I know i can do it manually but is it possible altering form_state['values] ?

1 Answer 1

0

You can use this code in your form submit function

$file ='public://not_imported_longanswer.csv';
$path = $base_url . '/sites/default/files/not_imported_longanswer.csv';
if (file_exists($file)) {
    file_delete($path);
}
3
  • thank you but i want to know if its possible only altering removing the field value on the form submitted array
    – ropic
    Commented Apr 27, 2016 at 5:52
  • Example: unset($form_state['values']['field_image'][LANGUAGE_NONE][3]);
    – ropic
    Commented Apr 27, 2016 at 5:57
  • you use unlink function instead of unset Commented Apr 27, 2016 at 6:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.