diff --git a/filefield_paths.module b/filefield_paths.module
index 9b19a97..77a0d9f 100644
--- a/filefield_paths.module
+++ b/filefield_paths.module
@@ -447,17 +447,3 @@ function _filefield_paths_get_field_types($reset = FALSE) {
   return $field_types;
 }
 
-/**
- * Check if a uri is considered local or not.
- *
- * @param string $uri
- *   A file uri.
- *
- * @return
- *   TRUE if the uri is using a local stream wrapper, or FALSE otherwise.
- */
-function filefield_paths_uri_is_local($uri) {
-  $scheme = file_uri_scheme($uri);
-  $wrappers = file_get_stream_wrappers(STREAM_WRAPPERS_LOCAL);
-  return !empty($wrappers[$scheme]) && empty($wrappers[$scheme]['remote']);
-}
diff --git a/modules/filefield_paths.inc b/modules/filefield_paths.inc
index 55c4cad..7cd45c3 100644
--- a/modules/filefield_paths.inc
+++ b/modules/filefield_paths.inc
@@ -53,8 +53,12 @@ function filefield_paths_filefield_paths_field_settings($field, $instance) {
 function filefield_paths_filefield_paths_process_file($type, $entity, $field, $instance, $langcode, &$items) {
   if (isset($instance['settings']['filefield_paths'])) {
     $settings = $instance['settings']['filefield_paths'];
+
+    // Check that the destination is writeable.
+    $wrappers = file_get_stream_wrappers(STREAM_WRAPPERS_WRITE);
     foreach ($items as &$file) {
-      if (filefield_paths_uri_is_local($file['uri']) && ($file['timestamp'] == REQUEST_TIME || $settings['active_updating'])) {
+      $scheme = $field['settings']['uri_scheme'];
+      if (!empty($wrappers[$scheme]) && ($file['timestamp'] == REQUEST_TIME || $settings['active_updating'])) {
         $token_data = array(
           'file' => (object) $file,
           $type => $entity
@@ -71,7 +75,8 @@ function filefield_paths_filefield_paths_process_file($type, $entity, $field, $i
 
         // Process filepath.
         $settings['file_path']['options']['context'] = 'file_path';
-        $file['uri'] = "{$field['settings']['uri_scheme']}://" . ltrim(filefield_paths_process_string($settings['file_path']['value'], $token_data, $settings['file_path']['options']) . "/{$file['filename']}", '/');
+        $path = filefield_paths_process_string($settings['file_path']['value'], $token_data, $settings['file_path']['options']);
+        $file['uri'] = file_stream_wrapper_uri_normalize("{$scheme}://{$path}/{$file['filename']}");
 
         // Finalize file if necessary.
         if ($file !== $old_file) {
diff --git a/tests/filefield_paths.test b/tests/filefield_paths.test
index 9b242d5..b7b9c2b 100755
--- a/tests/filefield_paths.test
+++ b/tests/filefield_paths.test
@@ -216,8 +216,9 @@ class FileFieldPathsGeneralTestCase extends FileFieldPathsTestCase {
   public function testReadOnly() {
     // Create a File field.
     $field_name        = strtolower($this->randomName());
+    $field_settings    = array('uri_scheme' => 'ffp');
     $instance_settings = array('file_directory' => "fields/{$field_name}");
-    $this->createFileField($field_name, $this->content_type, array(), $instance_settings);
+    $this->createFileField($field_name, $this->content_type, $field_settings, $instance_settings);
 
     // Get a test file.
     $file = $this->getTestFile('image');
