cancel
Showing results for 
Search instead for 
Did you mean: 

File upload on create content

oakman
Champ in-the-making
Champ in-the-making
Hi,

I have a problem regarding file uploads. Today, I have a form which creates content (via "create content") based on my custom content type. This custom content type has some mandatory properties. Now, I want to do the same when uploading a file. I know how to set the correct document type when uploading a file (via flash-upload.get.js), but the problem is that the content cannot be created due to my mandatory properties. Now I have two options:

1. Modify the "Upload" action to somehow include my mandatory properties.
2. Somehow configure the form to understand file upload.

Can the form service understand file upload today? Is there any way to modify the flash-upload to render the correct mandatory fields?

Thanks,

Niklas
16 REPLIES 16

billerby
Champ on-the-rise
Champ on-the-rise
Thank you very much iblanco. It seems that the only thing missing was to expose some dictionary service methods to javascript. I made a change in the webscript like this first: (well I guess the method is not needed at all anymore…):

function _DOCUMENTOS_isMultiValued(name)
{
   return dictionaryService.isMultiValued(name);
}

Then I made this java class which I declared as a spring bean:


package com.acando.alfresco.repo.jscript;

import org.alfresco.repo.jscript.BaseScopableProcessorExtension;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.namespace.QName;

/**
* Custom exposure of java services to javascript.
* @author eribil
*
*/
public class Dictionary extends BaseScopableProcessorExtension {
   private ServiceRegistry services;

   public void setServices(ServiceRegistry services) {
      this.services = services;
   }

   /**
    * Checks wheater a property has multivalue capacity.
    *
    * @return true if the property has multivalue capacity
    */
   public boolean isMultiValued(String name) {

      QName qname = QName.createQName(name);

      return services.getDictionaryService().getProperty(qname)
            .isMultiValued();

   }
}

Thanks.
/Erik

3acascia
Champ in-the-making
Champ in-the-making
Hi Niklas,
do you solve it?
I have the same needs. Any help is appreciated.

Thanks,
Toma

Hi
Can any one solve this file upload problem?
I need file upload in alfresco explorer using custom content
How is it possible?

Hi

I am new to Alfresco. currently using Alfresco4.2.. Me also facing with this same issue.. Can you please tell me how you fix this issue? After this issue solved needs to add dropdown with dynamic data.. please tell me how to fix these both issues

for dynamic drop down.
create one java class that will fetch your record from database and create class file and put in this path "/alfresco-4.2.f-3/apache-tomcat/webapps/alfresco/WEB-INF/classes/org"
for example in my java class i used org.custom package then path should be
"/home/attune/alfresco-4.2.f-3/apache-tomcat/webapps/alfresco/WEB-INF/classes/org/custom"

Then in  customModel.xml file
<code>
<constraints>

      <constraint name="my:departmentcategory" type="org.custom.ListOfDep">
         <parameter name="allowedValues">
            <list>
               
            </list>
         </parameter>
      </constraint>
</constraints>


<property name="my:department">
               <title>Department</title>
               <type>d:mltext</type>
               <multiple>false</multiple>
               <index enabled="false">
                  <atomic>false</atomic>
                  <stored>false</stored>
                  <tokenised>false</tokenised>
               </index>
               <constraints>
                  <constraint ref="my:departmentcategory" />

               </constraints>
            </property>

rabia
Champ in-the-making
Champ in-the-making
Can i upload image file susing DOTcmis?

raghav_bhardwaj
Champ on-the-rise
Champ on-the-rise
can anybody please explain what is happening in the above code. how come configs assigned different values?? and then statement if(configs) ?


googleDocsEnabled = (googleDocsConfig.getChildValue("enabled").toString() == "true");

      var configs = googleDocsConfig.getChildren("creatable-types"),
         creatableConfig,
         configItem,
         creatableType,
         mimetype;

      if (configs)
      {
         for (var i = 0; i < configs.size(); i++)
         {
            creatableConfig = configs.get(i).childrenMap["creatable"];
            if (creatableConfig)
            {
               for (var j = 0; j < creatableConfig.size(); j++)
               {
                  configItem = creatableConfig.get(j);
                  // Get type and mimetype from each config item
                  creatableType = configItem.attributes["type"].toString();
                  mimetype = configItem.value.toString();
                  if (creatableType && mimetype)
                  {
                     createContent.push(
                     {
                        mimetype: mimetype,
                        icon: creatableType,
                        permission: "create-google-doc",
                        formid: "doclib-create-googledoc",
                        label: "google-docs." + creatableType
                     });
                  }
               }