Changing the types of file formats that can be uploaded

You can change the types of file formats that are supported for users to upload as managed files. By changing the supported file formats, you can add or restrict the file formats that users can upload.

About this task

By default, users can upload files in any of the following formats:
  • Graphics (.gif, .jpe, .jpeg, .jpg, .png, .ico)
  • Document (.doc, .pdf, .ps, .text, .txt)
  • Presentation (.ppt)
  • Spreadsheet (.xls)
  • Archive (.zip, .gtar, .gz, .tar, .jar)
  • Media (.avi, .mov, .mpeg, .mpg, .qt, .ra, .swf, .wav)
Important: Users cannot include JavaScript in any managed files that are uploaded for the store, for example, CSS files.

Procedure

  1. Update the client.
    1. Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
    2. Complete one of the following steps:
      • WebSphere Commerce Version 7.0.0.0Feature Pack 1In the Enterprise Explorer view, expand LOBTools > WebContent > WEB-INF > src > lzx > commerce > attachment > objectDefinitions.
      • Introduced in Feature Pack 2In the Enterprise Explorer view, expand LOBTools > WebContent > config > commerce > attachment > objectDefinitions.
    3. Open one of the following files:
      Option Description
      ManagedFilePrimaryObjectDefinition.lzx
      1. Locate the instances of the FileTypes element within the file.
      2. Update the extension to set the supported file formats. By default, the supported file formats are defined with the following code:
        <!--- All file types -->
        <FileTypes description="${attachmentResources.fileTypesDescription_all}" extension="*.*" name="allFileTypesFilter"/>
        	        	
        <!--- Supported image image types: jpg, gif, jpe, jpeg -->
        <FileTypes description="${attachmentResources.fileTypesDescription_images}" extension="*.jpg;*.gif;*.jpe;*.jpeg;*.png" name="imageTypesFilter"/>
        			
        <!--- Supported document types: doc, ppt, pdf, ps, text, txt -->
        <FileTypes description="${attachmentResources.fileTypesDescription_documents}" extension="*.doc;*.pdf;*.ps;*.text;*.txt" name="documentTypesFilter"/>
        			
        <!--- Supported image media types: ra, swf, wav, mpg, mpeg, mov, avi, qt -->		  
        <FileTypes description="${attachmentResources.fileTypesDescription_media}" extension="*.ra;*.swf;*.wav;*.mpg;*.mpeg;*.mov;*.avi;*.qt" name="mediaTypesFilter"/>
        					  
        <!--- Supported archieved types: gz, zip, gtar, tar, jar -->
        <FileTypes description="${attachmentResources.fileTypesDescription_packaged}" extension="*.gz;*.zip;*.gtar;*.tar;*.jar;*.rpm" name="archievedTypesFilter"/>
        					  
        <!--- Supported presentation types: ppt -->
        <FileTypes description="${attachmentResources.fileTypesDescription_presentation}" extension="*.ppt" name="presentationTypesFilter"/>
        					  
        <!--- Supported spreadsheet types: xls -->
        <FileTypes description="${attachmentResources.fileTypesDescription_spreadSheet}" extension="*.xls" name="spreadsheetTypesFilter"/>
        			  
      ManagedFilePrimaryObjectDefinition.def
      1. Locate the instances of the FileTypes element within the file.
      2. Update the extension to set the supported file formats. By default, the supported file formats are defined with the following code:
        <!--- All file types -->
        <FileTypes description="${attachmentResources.fileTypesDescription_all}" extension="*.*" name="allFileTypesFilter"/>
        	        	
        <!--- Supported image image types: jpg, gif, jpe, jpeg -->
        <FileTypes description="${attachmentResources.fileTypesDescription_images}" extension="*.jpg;*.gif;*.jpe;*.jpeg;*.png" name="imageTypesFilter"/>
        			
        <!--- Supported document types: doc, ppt, pdf, ps, text, txt -->
        <FileTypes description="${attachmentResources.fileTypesDescription_documents}" extension="*.doc;*.pdf;*.ps;*.text;*.txt" name="documentTypesFilter"/>
        			
        <!--- Supported image media types: ra, swf, wav, mpg, mpeg, mov, avi, qt -->		  
        <FileTypes description="${attachmentResources.fileTypesDescription_media}" extension="*.ra;*.swf;*.wav;*.mpg;*.mpeg;*.mov;*.avi;*.qt" name="mediaTypesFilter"/>
        					  
        <!--- Supported archieved types: gz, zip, gtar, tar, jar -->
        <FileTypes description="${attachmentResources.fileTypesDescription_packaged}" extension="*.gz;*.zip;*.gtar;*.tar;*.jar;*.rpm" name="archievedTypesFilter"/>
        					  
        <!--- Supported presentation types: ppt -->
        <FileTypes description="${attachmentResources.fileTypesDescription_presentation}" extension="*.ppt" name="presentationTypesFilter"/>
        					  
        <!--- Supported spreadsheet types: xls -->
        <FileTypes description="${attachmentResources.fileTypesDescription_spreadSheet}" extension="*.xls" name="spreadsheetTypesFilter"/>
        			  
  2. Update the server.
    1. Open the Updating the WebSphere Commerce configuration file, and locate the command element for the AttachmentUpload command.
      <Command 
       maxuploadsize="10485760" 
       name="AttachmentUpload" 
       supportedFileExtension="doc,xls,ppt,ra,rpm,gz,pdf,ps,swf,zip,gtar,tar,wav,gif,jpe,jpg,jpeg,text,txt,mpg,mpeg,mov,avi,qt,jar,png" 
       uploadReturnURL_enabled="true" 
       viruscheck="no"
      />
    2. Change the value of the supportedFileExtension attribute to include only the file formats that you want business users to be allowed to upload.
    3. Run the ANT target: UpdateEAR target to update the runtime configuration with the master configuration file.

What to do next

After you complete your customization, you can complete the following steps.
Version Steps
  1. Right-click LOBTools Project; then click Build OpenLaszlo Project to produce an updated ManagementCenter.swf file under the workspace_dir\LOBTools\WebContent directory. This setting is the default environment setting.
  2. Test your changes by viewing them in the Management Center, using this URL: https://hostname:8000/lobtools.
  3. Deploy your changes to your production environment.
Introduced in Feature Pack 2
  1. Test your changes by viewing them in the Management Center, using this URL: https://hostname:8000/lobtools.
  2. Deploy your changes to your production environment.