I need to import files from external url. Files names are comming in this format:
http://somesitename/products/045639/photos/medium/1.jpg
I've made a quick hack at line 1157 in node_import.inc:
if (file_check_location($filepath, $find_in) && file_exists($filepath)) {
$value = $filepath;
return TRUE;
}else{
$pattern = '/[\s]*products\/([\d]*)/';
if ($file_content = file_get_contents($value)){
preg_match($pattern, $value, $matches);
if (isset($matches[1])){
$file_path = file_create_filename($matches[1] . '-'. basename($value), $find_in . '/products');
$new_path = file_save_data($file_content, $file_path);
if ($new_path){
$value = $new_path;
return true;
}
}
}
}
I think it could be added to next release, of course some admin settings are required.
Comments
Comment #1
Robrecht Jacques commentedProbably similar to #656756: Filefield Sources and Node import.
Comment #2
avpadernoI am closing this issue, since it is for a Drupal version that is no longer supported. Please re-open this issue if it is relevant for a project release for a supported Drupal version.