Jump to:

10990 Posts in 2727 Topics by 1818 members

All other Modules

SilverStripe Forums » All other Modules » File Upload Field in User Forms generates error

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1523 Views
  • micahsheets
    Avatar
    Community Member
    164 Posts

    File Upload Field in User Forms generates error Link to this post

    When I have a file upload field in a form on SS 2.3.1 using trunk of the userforms module I get this error on submit.

    It seems that the file is seen as an array.

    Error:
    ----------------------------------------------------------------------------------------------------------------------------

    [Notice] Array to string conversion
    POST /place-an-order-2/Form

    Line 109 in /Enterprise_designkh/deandaviseditions/sapphire/core/model/fieldtypes/DBField.php

    Source

    100     * this should include quotes.
    101     *
    102     * @param $value mixed The value to check
    103     * @return string The encoded value
    104     */
    105    function prepValueForDB($value) {
    106       if($value === null || $value === "" || $value === false) {
    107          return "null";
    108       } else {
    109          return "'" . addslashes($value) . "'";
    110       }
    111    }   
    112    
    113    /**
    114     * Prepare the current field for usage in a
    115     * database-manipulation (works on a manipulation reference).

    Trace

    * addslashes(Array)
    Line 109 of DBField.php
    * DBField->prepValueForDB(Array)
    Line 126 of DBField.php

  • micahsheets
    Avatar
    Community Member
    164 Posts

    Re: File Upload Field in User Forms generates error Link to this post

    I was able to fix this error by using DBField.php from trunk instead of the 2.3.1 version.

    1523 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.