Jahia Dev Forum > How can I upload...

0 (0 Good)
0 (0 Bad)

How can I upload files at current user content directory.

by  mohitbhunwalia »  2013/07/18 10:17

Hi, 

I want to upload a file on button click at user's content directory. For this I want to make module which will be used only for file upload.  I didn't get any idea , where to start. I saw   http://www.jahia.com/community/documentation/jahiapedia/jahia-modules/rest.html this but didn't get right way.

Please help me.........

  • How can I upload files at current user content directory.
    2013/07/18 10:17

    mohitbhunwalia <p> Hi,&nbsp;</p> <p> I want to upload a file on button click at user&#39;s content directory. For this I want to make module which will be used only for file upload. &nbsp;I didn&#39;t get any idea , where to start. I saw &nbsp;<span style="font-family: arial, sans-serif; font-size: 13px;">&nbsp;</span><span dir="ltr" id=":wh" style="font-family: arial, sans-serif; font-size: 13px;"><a href="http://www.jahia.com/community/documentation/jahiapedia/jahia-modules/rest.html" needshandler="needsHandler" style="color: rgb(0, 101, 204);">http://www.jahi<wbr />a.com/community<wbr />/documentation/<wbr />jahiapedia/jahi<wbr />a-modules/rest.<wbr />html</a>&nbsp;this but didn&#39;t get right way.</span></p> <p> Please help me.........</p>

  • Number of messages  15
    Registration date Jul 18, 2013
    0 (0 Good)
    0 (0 Bad)

    Re: How can I upload files at current user content directory.

    by  dgriffon »  2013/11/12 16:57

    Hello,

    Here the form to use in order to upload a file  in a specific directory

    <template:tokenizedForm>
        <c:set var="targetPath" value="${renderContext.site.path}/files"/>
        <form class="file_upload" action="<c:url value='${url.base}${targetPath}'/>" method="POST" enctype="multipart/form-data">
            <input type="file" name="file">
            <input type="hidden" name="jcrNodeType" value="jnt:file"/>
            <input type="hidden" name="jcrRedirectTo" value="<c:url value="${url.base}${renderContext.mainResource.node.path}"/>"/>
            <button>upload</button>
        </form>
    </template:tokenizedForm>
     
    The directory is defined by the action attribute of the form tag, (<c:url value='${url.base}${targetPath}'/> <c:set var="targetPath" value="${renderContext.site.path}/files"/> the files directory of the current site)
     
    best regards
     
    David

    David Griffon (dgriffon)

    Number of messages  76
    Registration date
    0 (0 Good)
    0 (0 Bad)

    how to get link in jquery for uploaded file

    by  ezhil »  2014/08/25 03:36

    say i uploaded index.xml, if i get in jquery by using for below url its say page not found exception

    <c:url value='${url.base}${targetPath}/files/index.xml'/>

    how can i fetch file using jquery or just direct me on how to get path in jsp

  • how to get link in jquery for uploaded file
    2014/08/25 03:36

    ezhil <p>say i uploaded index.xml, if i get in jquery by using for below url its say page not found exception</p> <p>&lt;c:url value=&#39;${url.base}${targetPath}/files/index.xml&#39;/&gt;</p> <p>how can i fetch file using jquery or just direct me on how to get path in jsp</p>

  • Number of messages  2
    Registration date Aug 25, 2014
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page