5

I've created Feeds importer to parse remote XML feed using HTTP Fetcher fetcher and I've created content type for that importer and Attached to it in Settings.

So my feed and import works fine after I've created importer node based on remote Feed URL.

However I would like to keep original remote XML feed file (fetched from the provided URL) similar as this happens for File upload fetcher to have a record/copy of it.

Is it possible? How?

1
  • I provide a solution for you, maybe in later I come and filled it with more details
    – Yuseferi
    Nov 15, 2015 at 11:39

1 Answer 1

2
+50

I have a simple solution for you but in this time I have not enough time to test it by myself.

First find your importer form_id, then in your custom module add custom submit handler then get URL of uploaded file then save it in where you want with system_retrieve_file(), e.g.:

function yourmodule_form_alter(&form, &$form_state, $form_id){
  if ($form_id == "importer_form_id") {
    $form['actions']['submit']['#submit'][] = 'yourcustom_form_submit_handler';
  }
}

function yourcustom_form_submit_handler($form, $form_state){
  // dpm($form_state['values']);
  // find file url and put it in $url
  // then try to fetch it with system_retrieve_file
  system_retrieve_file($url);
}

Your Answer

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

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