Error 400 Bad Request when I select a file for upload

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Taz_1999
    Junior Member
    • Oct 2019
    • 9

    Error 400 Bad Request when I select a file for upload

    Hello

    New user here.

    I've look through the forums, checked permissions, php-ini and think all is ok.

    But when I try to upload a file (small png's, pdf, odt, jpg etc), it flashes Error 400 Bad Request in read on top of the upload form, and the selected files does not show up next to the to the little paperclip after the error message has blinked an gone away.

    In the log (/data/logs/[todays date]) there is this line:

    [2019-10-31 12:56:48] Espo.ERROR: (400) POST /api/v1/Attachment; line: 84, file: /Library/WebServer/Sites/mammals.se/crm/application/Espo/Core/Controllers/Record.php [] []

    That is this part (the first IF in bold is line 84)

    public function actionCreate($params, $data, $request)
    {
    if (!is_object($data)) throw new BadRequest();

    if (!$request->isPost()) {
    throw new BadRequest();
    }

    if (!$this->getAcl()->check($this->name, 'create')) {
    throw new Forbidden();
    }

    $service = $this->getRecordService();

    if ($entity = $service->create($data)) {
    return $entity->getValueMap();
    }

    throw new Error();
    }

    Latest version of EspoCRM 5.7.5, also on Mac 10.13, with PHP 7.2.21 and MySQL 5.7.20


    Everything on this page is green: site name: /#Admin/systemRequirements

    Some things are:
    max_execution_time 360 Success
    max_input_time 360 Success
    memory_limit 256M Success
    post_max_size 256M Success
    upload_max_filesize 256M Success
    All folders are writeable or readable in green according to same page.

    Any tips about what to look for?



  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hello,
    I have tested it and it works w/o problems.
    Could you provide the next information:
    1. Is there any description about this error in the web server error log file?
    2. What web server do you use (apache or nginx)?

    It seems that this error occurs on your web server side, not Espo.

    Comment

    • Taz_1999
      Junior Member
      • Oct 2019
      • 9

      #3
      Thanks Maximus. That was a great clue.

      In the log for Apache (which i overlooked to check in) there is this:

      [Thu Oct 31 14:31:16.066633 2019] [php7:notice] [pid 66643] [client MYIPNUMBER:49632] PHP Warning: Unknown: Unable to create temporary file, Check permissions in temporary files directory. in Unknown on line 0, referer: (My EspoCRM install)
      [Thu Oct 31 14:31:16.067072 2019] [php7:notice] [pid 66643] [client MYIPNUMBER:49632] PHP Warning: Unknown: POST data can't be buffered; all data discarded in Unknown on line 0, referer: (My EspoCRM install)

      Checked php.ini that I remade a week ago when I upgraded PHP.

      And in there, there is this...

      (se image).

      ​​​​​​... I'm an idiot.

      Spelled the temporary path for PHP correctly and now uploads works! That was it!

      Thank you very much!
      Last edited by Taz_1999; 11-01-2019, 10:35 AM.

      Comment

      Working...