2

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">
  • Can you share some of the backend code you have to save the entry? – Aaron Berkowitz Oct 13 '15 at 16:56
  • I basically just used the entry form from Craft with the input action "entries/saveEntry" and the input file field – fingerfood Oct 14 '15 at 7:27
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.

| improve this answer | |
  • So a workaround solution would be to add a custom text field to the asset source and use that instead of title? – carlcs Oct 16 '15 at 7:16
  • @carlcs Not sure what you mean, but there aren’t any workarounds (besides writing a plugin that hooks into asset saving). – Brandon Kelly Oct 16 '15 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 Oct 16 '15 at 17:12

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.