Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-10688

Custom file upload does not work properly on Windows systems due to *nix-centric code in CustomField.php

    Details

    • Type: Patch
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.1.0, 4.1.1, 4.1.3, 4.1.5
    • Fix Version/s: 4.2.5
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      A custom file upload field, invoking CustomField.php, will not work due to the way that the directory structure is handled when renaming the file after upload. An explode on the "/" character is used; this should be replaced with a PHP file handling function for compatibility across different systems (specifically Windows).

      I'm using Drupal. I do not know if the patch is applicable to other CMSs.

      An error such as the following may be produced on a Windows system:

      Warning: rename
      (C:\inetpub\wwwroot\CiviCRM\sites\default\files\civicrm\custom\egcsv_2491da39e3c5e8a85c588de3aee16776.csv,
      C:\inetpub\wwwroot\CiviCRM\sites\default\files\civicrm\custom\C:\inetpub\wwwroot\CiviCRM\sites\default\files\civicrm\custom\egcsv_2491da39e3c5e8a85c588de3aee16776.csv):
      The filename, directory name, or volume label syntax is incorrect.
      (code: 123) in CRM_Core_BAO_CustomField::formatCustomField() (line 1669 of C:\inetpub\wwwroot\CiviCRM\sites\all\modules\civicrm\CRM\Core\BAO\CustomField.php).

      I have not tested the patch on a *nix system as yet, but it should not affect the functionality.

        Attachments

          Activity

            People

            • Assignee:
              deepak Deepak Srivastava
              Reporter:
              fadeout Fade Out
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: