• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

File upload option on Admin panel

#1
Hi,

I am trying to add an upload image feature for my addon. Is there any tutorials or references on how to upload a file using Xenforo Admin panel?

I have found this and helped me to complete the Admin Template and Controller. But upon using this code, I am always getting false from
Code:
$uploadItemImage = XenForo_Upload::getUploadedFile('imagename');
 
#2
I have checked a similar addon using image upload option. The addon is bdShop. But still I am getting false return value for
XenForo_Upload::getUploadedFile('imagename'); ?

Is there any permission needed? I have noticed a _preDispatch($action) method on the ControllerAdmin. Is there anything to do with that ?
 
#4
No its empty. I have used print_r($_FILES); on actionSaveStore() method and it printed an empty array on console.

My template code is as follows
Code:
<xen:form action="{xen:adminlink 'store/saveStore', $store}" method="post" class="xenForm formOverlay AutoValidator" data-redirect="on" upload="true">

    <fieldset>
        <xen:uploadunit label="{xen:phrase MAN_store_image}:" name="image" />
</fieldset>
<xen:submitunit save="{xen:phrase MAN_save_store}">
        <xen:if is="{$store.store_id}">
            <input type="button" value="{xen:phrase MAN_delete_store}..." accesskey="d" class="button OverlayTrigger"\
                data-href="{xen:adminlink store/deleteStore, $store}" />
        </xen:if>
    </xen:submitunit>
</xen:form>