Earthtracker's Blog

Just another WordPress.com weblog

Expressengine Assets file upload +no directory access in Channel form

Expressionengine Assets dont have any features to restrict file upload directory on channel form. So we use normal file input fields. But there is problem, it remove the selected file when next time the file is not updated.

So here the solution:
{member_photo}

<img src=”{url}” alt=”” />

<input type=”hidden” name=”member_photo” value=”{file_id}” id=”cur_file_id”>

<input type=”file” name=”member_photo” id=”file_upload”>

<input type=”hidden” name=”member_photo_filedir” value=”8″>

{/member_photo}

jQUery:
$(“#file_upload”).change(function (){ $(‘#cur_file_id’).val(”); });

Advertisements
Leave a comment »