0

I don't think I quite understand from the EE documentation how to upload a file using a Channel Form (previously SafeCracker).

I would like to upload my sermon audio files into the sermons upload path (http://example.com/sermon-files/). The file channel field I have is called {sermon_file}.

Here is the code from the documentation:

<div class="form-group">
    <input type="file" name="my_field_name" />
    <input type="hidden" name="my_field_name_directory" value="1" />
    <input type="hidden" name="my_field_name_hidden_file" value="{my_field_name}{file_name}{/my_field_name}" />
</div><!--/.form-group-->

This assumes that the {exp:channel:form channel="sermons"} tag is before all this code and contains a submit button.

My question is, what the heck do I put in these "my_field_name" placeholders?

Appreciate any help you can offer. Thank you much!

1

They should be the field name you gave your file field which you said was {sermon_file}. Or you could always just replace all that with {field:sermon_file}

<div class="form-group">
    <input type="file" name="sermon_file" />
    <input type="hidden" name="sermon_file_directory" value="1" />
    <input type="hidden" name="sermon_file_hidden_file" value="{sermon_file}{file_name}{/sermon_file}" />
</div><!--/.form-group-->
1
  • Thank you so much! The {field:sermon_file} thing was the thing that actually worked.
    – afferennen
    Mar 22 '15 at 0:31

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.