Support

Account

Home Forums Feature Requests Uploaded Files Location Reply To: Uploaded Files Location

  • Is this method still working in the latest ACF version?

    I was working on a site locally until my database crashed last week. I used a customised version of your code for the last few weeks, but since I restored the site from a backup a few days ago I keep getting a 500 error when this function runs.

    Here’s my code:

    function my_upload_directory( $param ) {
      $mydir          = '/music';
      $param['path']  = $param['basedir'] . $mydir;
      $param['url']   = $param['baseurl'] . $mydir;
      return $param;
    }
    
    function my_acf_upload_prefilter( $errors, $file, $field ) {
      // change the upload directory
      add_filter('upload_dir', 'my_upload_directory');
      return $errors;
    }
    add_filter('acf/upload_prefilter/name=music-cover-art', 'my_acf_upload_prefilter');
    

    Any idea where the problem might lie? I’m using the exact same code that worked before, the only thing that has changed seems to be the ACF version (5.5.3 to 5.5.5)?