Hi!

First time here, let's start with a weird behaviour of the file fieldtype.

On the website I'm building right now, when I upload a picture to the admin with this fieldtype, sometimes, but not always, the upload would fail with a pretty scary message saying Failed to create "/assets/showroom/".

(For those interested in these things, here is the error stack code, stating that for some reason it failed to create a directory :)

{
        foreach ($this->toIterator($dirs) as $dir) {
            if (is_dir($dir)) {
                continue;
            }

            if (true !== @mkdir($dir, $mode, true)) {
                throw new IOException(sprintf('Failed to create "%s".', $dir), 0, null, $dir);
            }
        }

I found a recent and (sadly) closed unresolved topic in the old forums here about this problem. Nothing came out of it.

Finally, I read the docs and found that on the file fieldtype page (here):

Two parameters exist, allowed - an array of allowed filetypes, and destination - the directory (from root) you wish to save the file(s).

The important info here is the from root part. I checked my YAML file and found that the destination value was starting with a /. The example on the doc page did not.

Once removed the faulty /, no more scary message from Statamic.

I wanted to post that here for those facing this behaviour. Hope that helps a bit.

Hey, Statamic team, is this behaviour intended or is it a bug?