upload file

cancel
Showing results for 
Search instead for 
Did you mean: 
rekhaahir
Active Member

upload file

how many ways or how to upload file in alfresco folder path  directly without get access or login .and how to display one custom editable form in  alfresco rather then default home page of alfresco right after login.

3 Replies
abhinavmishra14
Advanced

Re: upload file

There is no way you can upload files into alfresco without login or without getting access token (alf_ticket). If you allow doing this then it will be risky.

There are several ways you can upload files to alfresco repo:

1- Using share (drag and drop files into a folder, with latest version you can drag and drop folders as well. It will create subfolder within parent folder and upload files). 

https://docs.alfresco.com/6.0/tasks/library-add-content.html

https://docs.alfresco.com/6.0/tasks/library-folder-dragdrop.html

2- Using REST API :

Java based implementation example: https://javaworld-abhinav.blogspot.com/2014/09/upload-documents-to-alfresco-using-rest.html

3- Upload using FTP: https://docs.alfresco.com/6.1/concepts/fileserv-ftp-intro.html

4- Upload using webdav, It is ready to use from the moment you install Alfresco. Simply go to http://<hostSmiley Tongueort>/alfresco/webdav. Set up webdav location on windows: https://uvacollab.screenstepslive.com/s/help/m/sitetools/l/611578-how-do-i-set-up-webdav-for-windows...

5- Upload using CIFS: https://docs.alfresco.com/5.2/concepts/fileserv-subsystem-CIFS.html

You can also use this chrome extension to upload files in a folder: https://github.com/abhinavmishra14/alfresco-upload

I am not sure if it is still working with latest versions but refer this project which allows selecting custom metadata, it will give you some idea on implementation: https://github.com/softwareloop/uploader-plus

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
rekhaahir
Active Member

Re: upload file

hello,

this is  my  custom.ftl file wihch is html file and it will calling webscript and load js file into it. (share side)

<#-- JavaScript Dependencies
<@markup id="js">
</@>
-->

<#-- Stylesheet Dependencies
<@markup id="css">
</@>
-->

<#-- Surf Widget creation
<@markup id="widgets">
<@createWidgets group="dashlets"/>
</@>
-->

<@markup id="html">
<@uniqueIdDiv>
<#assign id = args.htmlid?html>
<#assign dashboardconfig=config.scoped['Dashboard']['dashboard']>

<div class="dashlet">
<div class="title">Custom Dashlet</div>
<div id="${id}-memberdir" class="body">


<div class="toolbar">
<div class="actions">
<form id="UploadForm" action="" method="post" enctype="multipart/form-data" accept-charset="utf-8">
File: <input type="file" name="file" id="fu"><br>
Title: <input name="title"><br>
Description: <input name="description"><br>
<input type="button" value="Create" onClick="callPost()" >
</form>
</div>
</div>
</div>
</div>
</@>
</@>
<script type="text/javascript">

function callPost() {
var title=document.getElementById("title");

Alfresco.util.Ajax.request({
url:Alfresco.constants.PROXY_URI +'/tutorials1/upload',
method:Alfresco.util.Ajax.POST,
dataObj:
{

},
successCallback:
{
fn: this.success,
scope:this

},
failureCallback:
{
fn: this.failure,
scope:this
}
});
alert("ok");
}
</script>

2 ..repo side upload.js file 

// extract file attributes
var title = args.title;
var description = args.description;

// extract file
var file = null;
for each (field in formdata.fields)            //error comes here
{
if (field.name == "file" && field.isFile)
{
file = field;
}
}

// ensure file has been uploaded
if (file.filename == "")
{
status.code = 400;
status.message = "Uploaded file cannot be located";
status.redirect = true;
}
else
{
// create document in company home from uploaded file
upload = companyhome.createFile(file.filename) ;
upload.properties.content.guessMimetype(file.filename);
upload.properties.content.write(file.content);
upload.properties.title = title;
upload.properties.description = description;
upload.save();
// setup model for response template
model.upload = upload;
}

            so it will gives error that formdata is not define ...may be its possible that bcoz of i use ajax call its not get formdata.

otherwise i should use 
<form action="${url.service}" method="post" enctype="multipart/form-data"> to call.

i.e in action tag with repo url but it's not working.

      

joreun
Active Member

Re: upload file

To complete this list, we could add "bulk importing" https://docs.alfresco.com/5.2/concepts/Bulk-Import-Tool.html