cancel
Showing results for 
Search instead for 
Did you mean: 

Récupérer la taille d'un fichier

jsatriani
Champ in-the-making
Champ in-the-making
Bonjour,
je souhaite récupérer la taille d'un document dans Alfresco.
Je récupère bien son nom "title", sa description "summary" mais je n'arrive pas à avoir son poids.

Des idées ?
Merci
5 REPLIES 5

rivarola
Champ on-the-rise
Champ on-the-rise
Quelle API ? JavaScript ?

jsatriani
Champ in-the-making
Champ in-the-making
Désolé je n'ai pas précisé
API REST

rguinot
Confirmed Champ
Confirmed Champ
L'attribut size n'existe pas ? postez un morceau de code éventuellement

hsohaib
Champ on-the-rise
Champ on-the-rise
Il n'existe pas d'attribut "size" directement accessible, mais vous pouvez le récupérer à partir de la propriété "{http://www.alfresco.org/model/content/1.0}content" = ContentModel.PROP_CONTENT ,voici un exemple :


public long getSize(NodeRef node) {

        String content = serviceRegistry.getNodeService().getProperty(node, ContentModel.PROP_CONTENT);
        java.util.regex.Pattern modele = java.util.regex.Pattern.compile("=");

        String size[] = modele.split(content);
        int end = size[3].indexOf("|");
        String tailleDoc = size[3].substring(0, end);
       
        return Long.parseLong(tailleDoc);

    }

pschh
Champ in-the-making
Champ in-the-making
et en utilisant tout simplement

<document>.properties.content.size ,

ça ne marche pas ???