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

Robrecht Jacques’s picture

Title: external file upload » Use remote files as filepath
Version: 6.x-1.0-rc4 » 6.x-1.x-dev
Issue tags: +filepath input_format
avpaderno’s picture

Issue summary: View changes
Status: Active » Closed (outdated)
Issue tags: -filepath input_format

I 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.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.