3

I'm running craft locally using MAMP and I'm trying to move assets into a subfolder when unploaded into an image field in my gallery section.

I'm trying to set the path to subfolder so it uses the slug. When I put {slug} into the field settings nothing happens when I upload the images and save the entry, it just pulls them all into the top level folder.

Im not sure if its something in the local file permissions or something but I can bring the images in fine and transforms work okay ie. they create folders and pop the images in fine.

Any help would be appreciated

  • Pretty sure you're running into this? craftcms.stackexchange.com/a/1574/57 – Brad Bell Aug 8 '14 at 21:34
  • Thanks for the quick response. Does this mean its not possible to dynamically generate the folders when uploading an image into the gallery. I may be misunderstanding the issue though. I can't see a way to set the upload location on assigning the field to an entry type. – Daryl Campbell Aug 8 '14 at 21:43
  • I think I understand now. You have to select "Restrict uploads to a single folder" instead of having a Default Upload Location? – Daryl Campbell Aug 8 '14 at 21:54
  • Maybe I'm misunderstanding, but it looks like you're trying to use the entry's {slug} in the asset upload URI, but the entry doesn't have a {slug} until the first time it has been saved. A bit of a catch-22. – Brad Bell Aug 8 '14 at 21:56
  • Thanks Brad, it was just me being really stupid :) I had wanted to have the option of selecting photos from another folder so in the field settings I had Default Upload Location with the {slug} in there. When I switched it to "restrict to single folder" and set the {slug} then it is all functioning as expected. I don't think it would make sense selecting a photo from another folder in this field as the asset wouldn't be able to move when entry is saved. Hope this makes sense. I just have the same issue as the other post now where I don't see the caption field until the entry is saved. – Daryl Campbell Aug 8 '14 at 22:11
2

Got the problem solved, I had wanted to have the option of selecting photos from another folder so in the field settings I had Default Upload Location with the {slug} in there. When I switched it to "restrict to single folder" and set the {slug} then it is all functioning as expected. I don't think it would make sense selecting a photo from another folder in this field as the asset wouldn't be able to move when entry is saved. Hope this makes sense. I just have the same issue as the other post now where I don't see the caption field until the entry is saved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.