1

Apologies if this has already been asked and answered, but I couldn't find any tangible example on how to actually do this.

All I'm trying to do is create a template in ExpressionEngine, and upload a small JPG file to a channel field that's set to a Channel Files field type.

As this post suggests, it should work the same as uploading to a regular File field type using the Channel Form tag, but it doesn't seem to be uploading the file. The code below works perfectly for the normal File field type for adding new entries:

{exp:channel:form channel='other_details'}

    <input type='hidden' name='title' value='Some new title here.' />

    <input type="hidden" name="custom_upload_hidden_file" value="">
    <input type="hidden" name="custom_upload_hidden_dir" value="2">
    <input type="hidden" name="custom_upload_directory" value="2">
    <input type="file" name="custom_upload">

    <input type='submit' value='Upload' />

{/exp:channel:form}

The file upload location is a location with ID 2, which is perfect, but I need to upload the file to a Channel Files field type, not a normal File field type. How do you achieve this?

Thank you in advance for any assistance!

1 Answer 1

1

Easiest way to do this and see the markup used for channel form is to use the following.

{exp:channel:form channel='other_details'}

    <input type='hidden' name='title' value='Some new title here.' />


    {!-- This will output the correct syntax for your file upload field specified in the cPanel. --}

    {field:custom_upload}

    <input type='submit' value='Upload' />

{/exp:channel:form}
1
  • 1
    Matts Id John: Bro you the man. Thnks a mill.
    – user7433
    Commented Jun 28, 2016 at 7:40

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.