Ok guys,
I know it has been attempted many times before (some attempts more successful than others) but I have developed my own SAEF file upload extension.
My extension is super easy to use… just install and add the following code to your SAEF form…
{exp:weblog:entry_form
weblog = "gallery"
lg_saef_file_upload = "y"
lg_saef_file_upload_dir_id = "1"
}
<input type="file" name="field_id_7" value="" />
<input type='submit' value='submit' />
{/exp:weblog:entry_form}
- All required / optional fields are respected
- File upload prefs are respected
- Duplicate files are renamed
Simple….
Like I said this has been attempted many times before so I want to get it right…
UPDATE 1 June 23rd 4:49pm
I have tweaked a bit of the code and added the requested edit feature (needs some testing)
So now if you have an edit form you can add a new hidden field that stores the original value. If the file upload element is empty the original value will be used otherwise the extension will try and overide the previous file.
Example:
{exp:weblog:entry_form
weblog = "gallery"
lg_saef_file_upload = "y"
lg_saef_file_upload_dir_id = "1"
}
<input type="file" name="field_id_7" value="" />
<input type="hidden" name="field_id_7" value="{custom_field_that_holds_the_data}" />
<input type='submit' value='submit' />
{/exp:weblog:entry_form}
Note there is no way to delete a file yet.. Hopefully that will be coming soon.
If you are having issues with logging into the cp turn off auto update checking when you install the extension.
Grab the latest download.
UPDATE 2 June 23rd 5:30pm
Ok after a bit more testing I have realised there is no need for the hidden field… It actually causes complications…
Here is a basic edit form:
{exp:weblog:entries entry_id="{segment_1}"}
{exp:weblog:entry_form
weblog = "upload_test"
lg_saef_file_upload = "y"
lg_saef_file_upload_dir_id = "1"
}
<input type="hidden" name="entry_id" value="{entry_id}" />
<input type="hidden" name="entry_date" value="{entry_date format='%Y-%m-%d %g:%i %A'}" />
<input type="text" name="title" value="{title}" />
<div>
<input type="file" name="field_id_224" value="" />
</div>
<div>
<input type="file" name="field_id_225" value="" />
</div>
<input type='submit' value='submit' />
{/exp:weblog:entry_form}
{/exp:weblog:entries}
You will obviously need to edit the field_ids and the weblogs entry loop… but I think we are getting there.
UPDATE 3 June 24th 8:08am
I have uploaded a new version which should crush the member login bug some user have been reporting..
