3

I have a frontend form to save an entry which includes a file upload input field:

<input type="file" name="fields[newsFile]">

The upload works fine, but is it also possible to set the title of the asset similar to the backend? Unfortunately, this doesn't work:

<input type="text" name="fields[newsFile][title]" value="Asset Name">
2
  • Can you share some of the backend code you have to save the entry? Commented Oct 13, 2015 at 16:56
  • I basically just used the entry form from Craft with the input action "entries/saveEntry" and the input file field
    – fingerfood
    Commented Oct 14, 2015 at 7:27

1 Answer 1

1

Sorry, but the answer is no; assets will initially just get titles based on their filenames until someone goes into the Control Panel and customizes them.

3
  • So a workaround solution would be to add a custom text field to the asset source and use that instead of title?
    – carlcs
    Commented Oct 16, 2015 at 7:16
  • @carlcs Not sure what you mean, but there aren’t any workarounds (besides writing a plugin that hooks into asset saving). Commented Oct 16, 2015 at 13:34
  • I thought it is only a problem with the asset's title and other asset fields, like a custom plain text field "myTitle" would be possible. But I'm probably wrong.
    – carlcs
    Commented Oct 16, 2015 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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