1. 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

Discussion in 'XenForo Development Discussions' started by Ajmal Salim, Jan 29, 2015.

  1. Ajmal Salim

    Ajmal Salim New Member


    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
    $uploadItemImage = XenForo_Upload::getUploadedFile('imagename');
  2. Ajmal Salim

    Ajmal Salim New Member

    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 ?
  3. tyteen4a03

    tyteen4a03 Well-Known Member

    Have you checked whether your $_FILES contained anything?
  4. Ajmal Salim

    Ajmal Salim New Member

    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
    <xen:form action="{xen:adminlink 'store/saveStore', $store}" method="post" class="xenForm formOverlay AutoValidator" data-redirect="on" upload="true">
            <xen:uploadunit label="{xen:phrase MAN_store_image}:" name="image" />
    <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}" />

Share This Page