Thursday, October 20, 2005

Maximum uploadable size of a Resource to Resource Gallery

Resource can be uploaded to resource galleries via Site Manager as well as via Resource Manager (web author). The size of the resource file which can be uploaded via Resource Manager can be changed by modifying the httpRuntime attribute in the relevant web.config file (a sample for that with explanation can be found here – MCMS faq).

Site Manager uses underlying ASP service to interact with MCMS server. So to change the upload resource size via Site Manager, some modification should be done in the IIS MetaBase.xml/service depending on Maximum size. If the maximum size is less than 100000 bytes, follow Step 1. Otherwise follow Step 2.

Step 1 - To restrict the size less than 100000 bytes:

  • Open MetaBase.xml file – this can be found in <windows installation path>\system32\inetsrv
  • Go to
    <IIsWebDirectory Location ="/LM/W3SVC/1/ROOT/NR/System/ResUpload"
    AppFriendlyName=""
    AppIsolated="2"
    AppRoot="/LM/W3SVC/1/Root/NR/System/ResUpload"
    AspMaxRequestEntityAllowed="xxxxxx"
    ></IIsWebDirectory>


    Set the AspMaxRequestEntityAllowed to required maximum size – it should be in bytes and less than 100000 bytes.
  • Stop the IIS (iisreset /stop).
  • Save MetaBase.xml(before saving, make a copy of that file).
  • Now start the IIS (iisreset /start).

Step 2 - To restrict the size more than or equal to 100000 bytes:

  • Asp service (Site Manager uses this to interact with MCMS Server) counts 100000 bytes as a chunk. So if the size is 100000 bytes or more, it will be divided in to 100000 byte chunks, so it will get uploaded without the maximum limit boundary which can be specified in Step1 – to avoid this must validate this in asp service.
  • Open resupload.asp in notepad – it can be found in <MCMS Installation folder>\Server\IIS_NR\System\ResUpload – have a copy of it before doing any modification.
  • WriteFile function should be modified. Add the code(bold) given below before the creation of “AEBinFile.AEBinFile.1” object.

    ……………
    if len(strFileExt)=0 then
    Response.End
    end if
    Dim maxSize
    maxSize = 1000000 ' maximum size of upload specified in MetaBase.xml
    nCount = Request.TotalBytes
    if nCount > maxSize then
    Response.Status = "500" 'Some error....
    Response.End
    end if
    Set BinFile = Server.CreateObject("AEBinFile.AEBinFile.1")
    …………

Note: As modifying resupload.asp is not supported, take precautions before using the 2nd method.

0 Comments:

Post a Comment

<< Home