Answers.Body: <p>For the first question you can go to Administer - System Settings - Safe File Extensions and add <code>.ods</code> to the list there.</p>
  <p>For the second one is <code>$value['name']</code> actually a string or is it an array?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-24T13:06:37.820Z
Answers.LastActivityDate: 2020-07-24T13:06:37.820Z
Answers.UserDisplayName: Demerit
Body: <ol>
  <li><p>I'm sending a .ods file name into the makeFileName method to get a unique string value for the file name. but it return a file name which is not ending in .ods instead it end with <code>.unknown</code>.</p>
  <p>Ex: <code>template_ods_65c986571c9c2737fff370ce4a745015.unknown</code></p>
  <p>but i need a file name like <code>template_65c986571c9c2737fff370ce4a745015.ods</code>.</p>
  </li>
  <li><p>Other thing is when i assign a returned string value into a variable, it gives me the array to string conversion error.
  <strong>code</strong></p>
  <p>$newName = CRM_Utils_File::makeFileName($value['name']);</p>
  <p><strong>Error</strong></p>
  </li>
  </ol>
  <blockquote>
  <p>Array to string conversion in
  /var/www/html/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php
  on line 554</p>
  <p>Warning: htmlspecialchars() expects parameter 1 to be string, array
  given in
  /var/www/html/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php
  on line 556</p>
  </blockquote>
  <p>I confused with these two error, i'll appreciate if someone could help me to resolve it</p>
  
Tags: <error>
Title: How to resolve Array to string conversion error
ThreadText: # How to resolve Array to string conversion error
  
  (Asked by: username_0 on 2020-07-24)
  
  1. I'm sending a .ods file name into the makeFileName method to get a unique string value for the file name. but it return a file name which is not ending in .ods instead it end with `.unknown`.
  
     Ex: `template_ods_65c986571c9c2737fff370ce4a745015.unknown`
  
     but i need a file name like `template_65c986571c9c2737fff370ce4a745015.ods`.
  2. Other thing is when i assign a returned string value into a variable, it gives me the array to string conversion error.
     **code**
  
     $newName = CRM\_Utils\_File::makeFileName($value['name']);
  
     **Error**
  
  > Array to string conversion in
  > /var/www/html/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php
  > on line 554
  >
  > Warning: htmlspecialchars() expects parameter 1 to be string, array
  > given in
  > /var/www/html/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php
  > on line 556
  
  I confused with these two error, i'll appreciate if someone could help me to resolve it
  
  **Tags:** error
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-07-24. Score: 1
  
  For the first question you can go to Administer - System Settings - Safe File Extensions and add `.ods` to the list there.
  
  For the second one is `$value['name']` actually a string or is it an array?
  
  
  ---
  
  