file_exists() expects parameter 1 to be a valid path, string given

前端 未结 5 1996
终归单人心
终归单人心 2020-12-07 01:12

I\'m designing a web application that can be customized based on which retail location the end user is coming from. For example, if a user is coming from a store called Farm

相关标签:
5条回答
  • 2020-12-07 01:31

    I got the same error before but I don't know if this solution of mine works on your problem you need to remove the "\0" try replace it:

    $cleaned = strval(str_replace("\0", "", $buttons_first));
    

    it worked on my case.

    0 讨论(0)
  • 2020-12-07 01:35

    I know this post was created on 2013 but didn't saw the common solution.

    This error occurs after adding multiple to the file submit form for example you are using files like this on php: $_FILES['file']['tmp_name'] But after the adding multiple option to the form. Your input name became file => file[]

    so even if you post just one file, $_FILES['file']['tmp_name'] should be change to $_FILES['file']['tmp_name'][0]

    0 讨论(0)
  • 2020-12-07 01:44

    Run a var_dump(strpos($buttons_first,"\0")), this warning could come up when a path has a null byte, for security reasons. If that doesn't work, check the length of the string and make sure it is what you'd expect, just in case there are other invisible bytes.

    0 讨论(0)
  • 2020-12-07 01:49

    It may be a problem with the path as it depends where you are running the script from. It's safer to use absolute paths. To get the path to the directory in which the current script is executing, you can use dirname(__FILE__).

    0 讨论(0)
  • 2020-12-07 01:53

    Add / before stores/, you are better off using absolute paths.

    0 讨论(0)
提交回复
热议问题