cancel
Showing results for 
Search instead for 
Did you mean: 

Upload document into alfresco using Angular JS without user credentials

sandeepreddy1
Star Contributor
Star Contributor

Hi Everyone,

I need help for Upload documents into alfresco using Angula JS without user credentials.

document upload with metadata and site-name

Can anyone help me out please.

2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator

By default it is not possible to upload documents without authentication details into Alfresco since all modifying APIs require authentication to properly determine user privileges and avoid unauthenticated spam. If you need to have unauthenticated upload (very dangerous) you'd first need to create some custom ReST API via web scripts for that where you might impose any sort of controls / protection yourself.

Hi Axel Faust  ,

Thank you so much for the reply ,

actually i made one external application that application have AD credentials, After logged in that application i am showing alfresco documents. in that page i need to add one more button like upload documents into alfresco.  in this i need help  for upload document without user credentials.

I am following this code

@RequestMapping(value = "/upload",headers=("content-type=multipart/*"), method = RequestMethod.POST)
public ResponseEntity<String> upload(HttpServletRequest request,
@RequestParam String siteName,
@RequestParam String contentAuthor,
@RequestParam String userid,
@RequestParam String password,
@RequestParam("uploadDirectoryPath") String uploadDirectory,

@RequestParam("uploadDocumentPath") MultipartFile uploadDocumentPath) {
Upload upload=new Upload();
try {

String ipAddress = request.getHeader("X-FORWARDED-FOR");
if (ipAddress == null) {
ipAddress = request.getRemoteAddr();
}
LOG.info("IPADDRESS:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"+ipAddress);
upload.setIpaddress(ipAddress);
upload.setRequestOn(DateUtils.getCurrentSystemTimestamp());
uploadManager.saveOrUpdate(upload);

LOG.info("-----------------------------------------------jsonObj.length():"+uploadDocumentPath.getOriginalFilename());
String imagePath = "";
//String categoryName = "";

upload.setSiteName(siteName);
upload.setContentAuthor(contentAuthor);
//upload.setContentTitle(URLEncoder.encode(contentTitle, "UTF-8"));;
upload.setUserid(userid);
upload.setPassword(password);
upload.setUploadDirectoryPath(uploadDirectory);
upload.setUploadDirectoryPath(uploadDocumentPath.getOriginalFilename());
/*final Part uploadDocumentPaths;