I have created my channel. I have added a file upload field. Furthermore, I can upload files fine from the admin control panel.
I created a channel form in a template. Users can submit entries fine.
Now I want to let those users upload files on the channel form.
What are the minimum fields required for this?
This alone does not work. Nothing gets uploaded to the folder while I submit the form:
<input type="file" name="my_files" />
my_files = is the actual Field I created for file uploads in that channel.
It seems after reading this: https://expressionengine.com/forums/topic/253034/how-remove-replace-edit-file-in-channel-form
All I need is to create one field such as: {field:my_files}
The documentation related to channel forms is completely different. Its talking about hidden field names and directories.
After testing with that field and checking the source code, I see what is wrong. The documentation is a complete mess.
It seems value=”1” is the actual ID of the upload directory. Not the directory name like it says in the documentation.
The part it talks about hidden files and directories, you actually need to append _hidden_dir to the field name, not just use the field name or the upload directory name.
The documentation needs serious fixes with proper examples here.
I figured this out already after testing and playing around. What I did not figured out so far is how to allow multiple files to be uploaded in one POST submit without having to use the grid file (which I don’t need right now).
It seems if I create several file upload fields, it will just upload one file even if you manually select more than one with the browser file picker.
Or do I need to create more file fields in the channel for this?
Hello! I am currently experiencing very similar issues with the channel form file upload field and was hoping you could shine a light on things for me. I am using a manually constructed file field to allow non-logged-in users to create a new channel entry. They do not need editing capabilities.
Everything on the form is working fine except the file upload field. This is the code I am currently using - based somewhat on information in your post:
<label for=”upload_drawings”>Upload A File (DOC, PDF, JPG, PNG)</label>
<input type=”file” class=”form-control” id=”upload_drawings” name=”upload_drawings” accept=”.doc,.docx,.pdf,.jpg,.jpeg,.png,.gif”>
<input type=”hidden” name=”estimate_uploads” value=”13” />
File Field Short Name: upload_drawings
Upload Directory Name: Estimate Uploads
Upload Directory ID: 13
I am using EE Ver. 5.4.2
Any help would be greatly appreciated!!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.