<form action="file/doUpload" method="post" autocomplete="off" enctype="multipart/form-data" class="pageForm required-validate" onsubmit="return iframeCallback(this, $.bringBack)">
    <input type="hidden" name="_csrf" value="<@tools.csrfToken admin=true/>"/>
    <input type="hidden" name="field" value="${field!'fileName'}"/>
    <input type="hidden" name="originalField" value="${originalField!}"/>
    <#if privatefile?has_content && "true"=privatefile>
        <input type="hidden" name="privatefile" value="true"/>
        <input type="hidden" name="userId" value="${userId!}"/>
    </#if>
    <div class="pageContent">
        <div class="tabs">
            <div class="tabsHeader">
                <ul>
                    <li><a href="javascript:;" class="tabImageBtn" onclick="$('button[type=submit]',$.pdialog.getCurrent()).show();return false;"><@t.page 'file'/></a></li>
                    <li><a href="javascript:;" onclick="$('button[type=submit]',$.pdialog.getCurrent()).hide();return false;"><@t.page 'upload.log'/></a></li>
                    <#if !privatefile?has_content || "false"=privatefile>
                        <li><a href="common/file_list.html?field=${(field?url)!}&originalField=${(originalField?url)!}&fileTypes=${fileTypes!}" class="j-ajax" onclick="$('button[type=submit]',$.pdialog.getCurrent()).hide();return false;"><@t.page 'webfile'/></a></li>
                    </#if>
                </ul>
            </div>
            <div class="tabsContent unitBox">
                <div class="pageFormContent" layoutH>
                    <#if fileTypes?has_content&&'image'=fileTypes>
                        <div class="upload-wrap">
                            <input type="file" name="file" accept="image/*" class="valid" style="left: 0px;">
                            <input type="hidden" name="base64File"/>
                            <input type="hidden" name="originalFilename"/>
                            <div class="cutinput">
                                <input name="width" type="number" value="${width!300}"/>
                                <span>*</span>
                                <input name="height" type="number" value="${height!300}"/>
                            </div>
                        </div>
                    <#else>
                        <input type="file" name="file" class="required" size="30"<#if fileTypes?has_content&&'video'=fileTypes> accept="video/*"</#if>/>
                    </#if>
                </div>
                <div class="pageFormContent" layoutH>
            <@log.uploadList userId=admin.id fileTypes=fileTypes privatefile=privatefile pageIndex=1 pageSize=21>
                <#list page.list as a>
                    <div class="image-list">
                        <#if 'image'=t.fileType(a.filePath)>
                            <img src="<#if a.privatefile>${getPrivateUrl(a.filePath?url_path)}<#else>${getUrl(a.filePath?url_path)}</#if>" alt="${a.originalName!}" title="${a.originalName!}">
                            <a href="javascript:;" class="edit-icon" onclick="$('.tabImageBtn',$.pdialog.getCurrent()).trigger('click');$('div.upload-wrap', $.pdialog.getCurrent()).editImg({imgUrl:'<#if a.privatefile>${getPrivateUrl(a.filePath?url_path)}<#else>${getUrl(a.filePath?url_path)}</#if>',imgName:'${(a.originalName?has_content)?then(a.originalName,a.filePath!)?js_string}'});return false;"></a>
                        <#else>
                            <i class="thumb icon-file-alt icon-large"></i>
                        </#if>
                        <p title="<@t.page 'width'/>:${a.width!},<@t.page 'height'/>:${a.height!}">
                            <a href="javascript:;" onclick="$.bringBack({'${field!'fileName'}':'${(a.filePath?url_path?js_string)!}','fileType':'${a.fileType!}','fileSize':'${a.fileSize!}','width':'${a.width!}','height':'${a.height!}','${originalField!'originalName'}':'${(a.originalName?js_string)!}'});return false;">
                                ${(a.originalName?has_content)?then(a.originalName,a.filePath!)}<#if a.fileSize?has_content>(${a.fileSize})</#if>
                            </a>
                        </p>
                    </div>
                </#list>
            </@log.uploadList>
                </div>
                <#if !privatefile?has_content || "false"=privatefile>
                    <div id="fileBox" class="pageFormContent" layoutH>
                    </div>
                </#if>
            </div>
        </div>
    </div>
    <div class="formBar">
        <ul>
            <li><button type="submit" class="buttonActive" title="ctrl+s"><@t.page 'upload'/></button></li>
            <li><button type="button" class="button" onclick="$.bringBack({'${field}':''});return false;"><@t.page 'button.clear_select'/></button></li>
            <li><button type="button" class="button close"><@t.page 'button.close'/></button></li>
        </ul>
    </div>
</form>