locked
how to increase upload size of a documnet upto 20 MB....in an asp.net application. RRS feed

  • Question

  • User442781244 posted

    HI

    masters

    In web.cong  file

    <httpRuntime executionTimeout=" " maxRequestLength=" " useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100"/>

    what to put the value in execution timeout and maxreuesttimeout????

    or I have to change some other setting in more places?????

    kindly suggest.....it very urgent

    Sunday, August 4, 2013 7:28 AM

Answers

  • User281315223 posted

    You likely will need to update your maxRequestLength within your web.config to handle files and uploads that are large (as the default limit is often 4MB). This can be handled within the <system.web> section of your web.config or the <system.webServer> section if you want to handle it at the IIS level (both are probably a good idea).

    It's important to know that maxAllowedContentLength is measured in bytes and maximumRequestLength is measured in kilobytes when settings these values so you'll need to adjust them accordingly if you plan on handling much larger files : 

    <configuration>
        <system.web>
            <!-- This will handle requests up to 1024MB (1GB) -->
            <httpRuntime maxRequestLength="1048576" timeout="3600" />
        </system.web>
    </configuration>
    
    <!-- IIS Specific Targeting (noted by the system.webServer section) -->
    <system.webServer>
       <security>
          <requestFiltering>
             <!-- This will handle requests up to 1024MB (1GB) -->
             <requestLimits maxAllowedContentLength="1048576000" />
          </requestFiltering>
       </security>
     </system.webServer>

    If you wanted to use 20MB as a limit, you would need to change the values to the following respectively : 

    <configuration>
        <system.web>
            <!-- This will handle requests up to 20MB -->
            <httpRuntime maxRequestLength="20480" timeout="3600" />
        </system.web>
    </configuration>
    
    <!-- IIS Specific Targeting (noted by the system.webServer section) -->
    <system.webServer>
       <security>
          <requestFiltering>
             <!-- This will handle requests up to 20MB -->
             <requestLimits maxAllowedContentLength="20971520" />
          </requestFiltering>
       </security>
     </system.webServer>

    If you don't see these sections within your existing web.config file, you'll simply need to copy them in.

    Updating the maxRequestLength property is likely going to be the easiest method of handling this, however there are alternatives such as libraries like NeatUpload, which are designed to handle large files and can handle uploading files as streams to your preferred method of storage.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, August 4, 2013 8:25 AM

All replies

  • User-1716253493 posted
    Set also : <system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength=" 1048576000" /> </ requestFiltering> </security> </ system.webServer> the value in kilo byte
    Sunday, August 4, 2013 8:13 AM
  • User442781244 posted

    hi

    oned_gk

    could u plz tell me this is sufficient....i saw something like this

    <system.web>

    <httpruntime maxreuestlengh =2097151

    <system.web>

    which one should in adopted...i am totally confused

    <system.webServer> there is not <security> tag.

    Sunday, August 4, 2013 8:17 AM
  • User-1716253493 posted
    http://stackoverflow.com/questions/3853767/maximum-request-length-exceeded
    Sunday, August 4, 2013 8:21 AM
  • User281315223 posted

    You likely will need to update your maxRequestLength within your web.config to handle files and uploads that are large (as the default limit is often 4MB). This can be handled within the <system.web> section of your web.config or the <system.webServer> section if you want to handle it at the IIS level (both are probably a good idea).

    It's important to know that maxAllowedContentLength is measured in bytes and maximumRequestLength is measured in kilobytes when settings these values so you'll need to adjust them accordingly if you plan on handling much larger files : 

    <configuration>
        <system.web>
            <!-- This will handle requests up to 1024MB (1GB) -->
            <httpRuntime maxRequestLength="1048576" timeout="3600" />
        </system.web>
    </configuration>
    
    <!-- IIS Specific Targeting (noted by the system.webServer section) -->
    <system.webServer>
       <security>
          <requestFiltering>
             <!-- This will handle requests up to 1024MB (1GB) -->
             <requestLimits maxAllowedContentLength="1048576000" />
          </requestFiltering>
       </security>
     </system.webServer>

    If you wanted to use 20MB as a limit, you would need to change the values to the following respectively : 

    <configuration>
        <system.web>
            <!-- This will handle requests up to 20MB -->
            <httpRuntime maxRequestLength="20480" timeout="3600" />
        </system.web>
    </configuration>
    
    <!-- IIS Specific Targeting (noted by the system.webServer section) -->
    <system.webServer>
       <security>
          <requestFiltering>
             <!-- This will handle requests up to 20MB -->
             <requestLimits maxAllowedContentLength="20971520" />
          </requestFiltering>
       </security>
     </system.webServer>

    If you don't see these sections within your existing web.config file, you'll simply need to copy them in.

    Updating the maxRequestLength property is likely going to be the easiest method of handling this, however there are alternatives such as libraries like NeatUpload, which are designed to handle large files and can handle uploading files as streams to your preferred method of storage.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, August 4, 2013 8:25 AM
  • User442781244 posted

    Hi

    rion

    i just want to know..when i upload large files...unable to upload.

    now in my webconfig see this...there is no <security > tag. so plz tell me it is necessary to put security tag...and tell me place where to put code .kindly assist

    <system.webServer>
    		<validation validateIntegratedModeConfiguration="false"/>
    		<modules>
    			<remove name="ScriptModule"/>
    			<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></modules>
    		<handlers>
    			<remove name="WebServiceHandlerFactory-Integrated"/>
    			<remove name="ScriptHandlerFactory"/>
    			<remove name="ScriptHandlerFactoryAppServices"/>
    			<remove name="ScriptResource"/>
    			<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    			<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    			<add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></handlers></system.webServer>


    Sunday, August 4, 2013 8:38 AM
  • User281315223 posted

    Yes, you'll need to add it.

    Simply copy and paste the following section into your <system.webServer> section : 

    <security>
          <requestFiltering>
             <!-- This will handle requests up to 20MB -->
             <requestLimits maxAllowedContentLength="20971520" />
          </requestFiltering>
    </security>

    So your overall <system.webServer> section (provided your example) will look like this : 

    <system.webServer>
    	<validation validateIntegratedModeConfiguration="false"/>
            <!-- This will handle your upload sizes -->
            <security>
                    <requestFiltering>
                            <!-- This will handle requests up to 20MB -->
                           <requestLimits maxAllowedContentLength="20971520" />
                    </requestFiltering>
            </security>
    	<modules>
    		<remove name="ScriptModule"/>
    		<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            </modules>
    	<handlers>
    		<remove name="WebServiceHandlerFactory-Integrated"/>
    		<remove name="ScriptHandlerFactory"/>
    		<remove name="ScriptHandlerFactoryAppServices"/>
    		<remove name="ScriptResource"/>
    		<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    		<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    		<add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            </handlers>
    </system.webServer>

    As I mentioned previously, you may want to add it within your <system.web> section as well.

    Sunday, August 4, 2013 8:41 AM
  • User442781244 posted

    hi

    rion

    i have to also add this also in web. config file

    <configuration>
        <system.web>
            <!-- This will handle requests up to 20MB -->
            <httpRuntime maxRequestLength="20480" timeout="3600" />
        </system.web>
    </configuration>



    Sunday, August 4, 2013 8:43 AM
  • User281315223 posted

    That should be all that you need to handle the larger uploads :)

    Sunday, August 4, 2013 8:44 AM
  • User442781244 posted

    hi rion

    i tried

    but not working. kindly see webconfig code, plz help

    <?xml version="1.0"?>
    <!-- 
        Note: As an alternative to hand editing this file you can use the 
        web admin tool to configure settings for your application. Use
        the Website->Asp.Net Configuration option in Visual Studio.
        A full list of settings and comments can be found in 
        machine.config.comments usually located in 
        \Windows\Microsoft.Net\Framework\v2.x\Config 
    -->
    <configuration>
    	<configSections>
    		<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    			<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    				<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
    				<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    					<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
    					<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
    					<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
    					<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/></sectionGroup></sectionGroup></sectionGroup></configSections><appSettings/>
    	<connectionStrings>
    		<add name="ConnectionStringFT" connectionString="Data Source=filetrac;Persist Security Info=True;User ID=ftweb;Password=ftweb;Unicode=True" providerName="System.Data.OracleClient"/>
    	</connectionStrings>
    	<system.web>
        <!-- This will handle requests up to 1024MB (1GB) -->
        <httpRuntime executionTimeout="3600" maxRequestLength="1048576" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100"/>
        <!-- 
                Set compilation debug="true" to insert debugging 
                symbols into the compiled page. Because this 
                affects performance, set this value to true only 
                during development.
    
                Visual Basic options:
                Set strict="true" to disallow all data type conversions 
                where data loss can occur. 
                Set explicit="true" to force declaration of all variables.
            -->
    		<compilation debug="true" strict="false" explicit="false">
    			<assemblies>
    				<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    				<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    				<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    				<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
    		<pages validateRequest="false">
    			<namespaces>
    				<clear/>
    				<add namespace="System"/>
    				<add namespace="System.Collections"/>
    				<add namespace="System.Collections.Specialized"/>
    				<add namespace="System.Configuration"/>
    				<add namespace="System.Text"/>
    				<add namespace="System.Text.RegularExpressions"/>
    				<add namespace="System.Web"/>
    				<add namespace="System.Web.Caching"/>
    				<add namespace="System.Web.SessionState"/>
    				<add namespace="System.Web.Security"/>
    				<add namespace="System.Web.Profile"/>
    				<add namespace="System.Web.UI"/>
    				<add namespace="System.Web.UI.WebControls"/>
    				<add namespace="System.Web.UI.WebControls.WebParts"/>
    				<add namespace="System.Web.UI.HtmlControls"/>
    			</namespaces>
    			<controls>
    				<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    				<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></controls></pages>
    		<!--
                The <authentication> section enables configuration 
                of the security authentication mode used by 
                ASP.NET to identify an incoming user. 
            -->
    		<authentication mode="Windows"/>
    		<!--
                The <customErrors> section enables configuration 
                of what to do if/when an unhandled error occurs 
                during the execution of a request. Specifically, 
                it enables developers to configure html error pages 
                to be displayed in place of a error stack trace.
    
            <customErrors mode="Off" defaultRedirect="GenericErrorPage.htm">
                <error statusCode="403" redirect="NoAccess.htm" />
                <error statusCode="404" redirect="FileNotFound.htm" />
            </customErrors>
            -->
    		<customErrors mode="Off" defaultRedirect="~/error.aspx"></customErrors>
    		<sessionState timeout="30" />
    		<httpHandlers>
    			<remove verb="*" path="*.asmx"/>
    			<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    			<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    			<add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></httpHandlers>
    		<httpModules>
    			<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></httpModules></system.web>
    	<system.codedom>
    		<compilers>
    			<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
    				<providerOption name="CompilerVersion" value="v3.5"/>
    				<providerOption name="WarnAsError" value="false"/></compiler>
    			<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
    				<providerOption name="CompilerVersion" value="v3.5"/>
    				<providerOption name="OptionInfer" value="true"/>
    				<providerOption name="WarnAsError" value="false"/></compiler></compilers></system.codedom>
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <!-- This will handle your upload sizes -->
        <security>
          <requestFiltering>
            <!-- This will handle requests up to 1GB -->
            <requestLimits maxAllowedContentLength="1048576000" />
          </requestFiltering>
        </security>
        <modules>
          <remove name="ScriptModule"/>
          <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </modules>
        <handlers>
          <remove name="WebServiceHandlerFactory-Integrated"/>
          <remove name="ScriptHandlerFactory"/>
          <remove name="ScriptHandlerFactoryAppServices"/>
          <remove name="ScriptResource"/>
          <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
          <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
          <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </handlers>
      </system.webServer>
    	<runtime>
    		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    			<dependentAssembly>
    				<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
    				<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/></dependentAssembly>
    			<dependentAssembly>
    				<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
    				<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/></dependentAssembly></assemblyBinding></runtime></configuration>
    

    Sunday, August 4, 2013 10:30 AM
  • User281315223 posted

    Your web.config appears to be correct.

    Are you experiencing any issues or is it not working properly?

    Sunday, August 4, 2013 10:58 AM
  • User442781244 posted

    if anybody has any idea then plz tell me how to solve this problem.

    Sunday, August 4, 2013 10:59 AM
  • User281315223 posted

    What errors are you experiencing?

    The two suggested methods should fix your issue and handle how large the attachments and uploads that your application should be able to handle (assuming that you are using something like a File Upload).

    Sunday, August 4, 2013 11:04 AM
  • User442781244 posted

    actually in application i have tried but unable to upload larger doument. no error. only upload procss is not happening. what is the proble,. so plz help

    i have used

    <httpRuntime executionTimeout="3600" maxRequestLength="1048576"

    <requestLimits maxAllowedContentLength="1048576000" />in this 3 zeroes are more. this is problem ????

    kindly suggest

     

    ya i have application that should be uploaded drom your computer and then after upload you can down load it. this type of application. just like online entry of letter in a office.

    Sunday, August 4, 2013 11:05 AM
  • User281315223 posted

    The code that you are using should work assuming that you are just using a basic File Upload through ASP.NET.

    Sunday, August 4, 2013 11:33 AM
  • User442781244 posted

    hi

    rion here is the code of that file upload

    								<tr>
    									<td width="19%" height="24" align="left">&nbsp; Soft Copy File</td>
    									<td width="82%" height="24" colspan="4" align="left">
    									&nbsp;<asp:FileUpload ID="txsoftcopy" runat="server" Width="390px" /></td>
    								</tr>

    now plz suggest what to do to solve my problem

    Sunday, August 4, 2013 11:40 AM
  • User281315223 posted

    I just created a very simple example similar to yours (with updating the web.config) and using the following markup : 

    <form id="form1" runat="server">
           <asp:FileUpload ID="txsoftcopy" runat="server" Width="390px" />
            <asp:Button ID="Upload" runat="server" />
    </form>

    and using the very basic code-behind : 

    protected void Page_Load(object sender, EventArgs e)
    {
          //Check if a PostBack occurred
          if (IsPostBack)
          {
                //Grab your file
                var file = txsoftcopy.PostedFile;
          }
    }

    And it appears to be working as it should on my local machine.

    Sunday, August 4, 2013 11:51 AM
  • User442781244 posted

    i am not getting....in my application smaller file is uploaded sucessfully but larger files are not uploaded. So what should i do. plz assist rion. i need your valuable suggestion.

    Sunday, August 4, 2013 11:54 AM
  • User281315223 posted
    I'm not quite sure what could be going wrong or if something is interfering with the settings mentioned. The two properties mentioned should be all that you need to handle large uploads. Is there any chance you could be editing the wrong web.config file?
    Sunday, August 4, 2013 12:10 PM
  • User442781244 posted

    web.config file is correct. rion i am not getting what to do??/??

    how to identify problem

    Sunday, August 4, 2013 12:19 PM
  • User281315223 posted

    I'm not quite sure what could be the issue as I just used the example above to successfully upload an 100MB+ file and was able to recieve it from my server-side code.

    My example web.config for this thrown-together example appears below : 

    <?xml version="1.0" encoding="utf-8"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    <configuration>
      <configSections>
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
      </configSections>
      <connectionStrings>
        <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-WebApplication6-20130722144122;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-WebApplication6-20130722144122.mdf" />
      </connectionStrings>
      <system.web>
        <compilation debug="true" targetFramework="4.5" />
        <httpRuntime targetFramework="4.5" maxRequestLength="1048576" />
        <pages>
          <namespaces>
            <add namespace="System.Web.Optimization" />
          </namespaces>
          <controls>
            <add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />
          </controls>
        </pages>
        <authentication mode="Forms">
          <forms loginUrl="~/Account/Login" timeout="2880" defaultUrl="~/" />
        </authentication>
        <profile defaultProvider="DefaultProfileProvider">
          <providers>
            <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
          </providers>
        </profile>
        <membership defaultProvider="DefaultMembershipProvider">
          <providers>
            <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
          </providers>
        </membership>
        <roleManager defaultProvider="DefaultRoleProvider">
          <providers>
            <add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
          </providers>
        </roleManager>
        <!--
                If you are deploying to a cloud environment that has multiple web server instances,
                you should change session state mode from "InProc" to "Custom". In addition,
                change the connection string named "DefaultConnection" to connect to an instance
                of SQL Server (including SQL Azure and SQL  Compact) instead of to SQL Server Express.
          -->
        <sessionState mode="InProc" customProvider="DefaultSessionProvider">
          <providers>
            <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
          </providers>
        </sessionState>
      </system.web>
      <system.webServer>
        <security>
          <requestFiltering>
            <!-- This will handle requests up to 1GB -->
            <requestLimits maxAllowedContentLength="1048576000" />
          </requestFiltering>
        </security>
      </system.webServer>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
            <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" />
            <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
      <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
      </entityFramework>
    </configuration>
    Sunday, August 4, 2013 3:26 PM
  • User-1716253493 posted

    actually in application i have tried but unable to upload larger doument. no error. only upload procss is not happening. what is the proble,. so plz help

    Seem like the problem from your upload code, is it your own code?

    Sunday, August 4, 2013 8:33 PM
  • User442781244 posted

    hi

    unable to upload even 1 mb files.only upto 100kb files are uploaded. kindly assist

    hi i have following code..this the code written on save button.....after upload i have 1 button i.e save button. kindly see code and suggest me. ..i am not getting download option. plz see my webconfig and suggest me

    Dim flen As Integer
                flen = txsoftcopy.FileBytes.Length
                If flen < 1000000 Then
                    rst(0).Value = txsoftcopy.FileBytes
                    rst.Update()
                Else
                    rst(1).Value = ""
                    rst.Update(

    Monday, August 5, 2013 1:49 AM
  • User-1596463 posted

    Hi, love4asp.net

    simply add in web.config:

      <system.web>

      <httpRuntime maxRequestLength="20480" enable="true" executionTimeout="300"/>

      </system.web>

    Monday, August 5, 2013 2:31 AM
  • User442781244 posted

    i did this..but have some problem in my code plz take look to code and suggest me ..how to modify

    <%@ Page Language="VB" AspCompat="true" Explicit="false" EnableEventValidation="false" Inherits="myPage" %>
    <%--<%@ Import namespace="ADODB" %><%  RStoTablePre()%>--%>
    <script runat="server">   
    
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
            If Request("op") = "open" Then
                BID.Value = openRecords("LETTERMASTER", " ID=" & Request("ID"))
                
            End If
        End Sub
    
        Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs)
            On Error Resume Next
            
            DBInit()
            Err.Clear()
            'response.write("Select department_code,department_name from departments where department_code='" & dept98 & "'")
            RStoCombo("select distinct vip_catagory from lettermaster  where office_code in (select OFFICE_CODE from offices where DEPARTMENT_CODE='" & dept98 & "')", 0, 0, txVIP_CATAGORY, "")
            txsender_date.Text = Date.Today.ToShortDateString
            txVIP_CATAGORY.Attributes.Add("onhelp", "var new_vh=window.prompt('Enter the New Catagory Name','');if ((new_vh!='')&&(new_vh!=null)) {var vopt;vopt=this; vopt.options[vopt.length]=new Option(new_vh,new_vh,vopt.defaultSelected,true)}return(false);")
            RStoCombo("Select office_name, office_code from offices where department_code='" & dept98 & "' order by 1", 0, 1, txother_details, "")
    
        End Sub
    
    
        Protected Sub btSave_Click(ByVal sender As Object, ByVal e As System.EventArgs)
           On Error Resume Next
            
            Dim exFld As String = "", exVal As String = ""
            diaryno = getdiarynol()
            response.write (diaryno)
            Select Case txFILED.SelectedItem.Text
                
                Case "Nothing"
                Case "Send"
                    exFld = exFld & "disp_office_code;"
                    exVal = exVal & BOfficeFile.Text & ";"
                Case "File"
                    exFld = exFld & "file_Code;"
                    exVal = exVal & BOfficeFile.Text & ";"
            End Select
    
            err.clear
            
            FileId = SaveData("filetracker.LETTERMASTER", " ID=" & BID.Value, exFld & "OFFICE_CODE;DIARY_NO;USER_CODE;FILETYPE", exVal & office98 & ";" & diaryno & ";" & user98 & ";" & Right(txsoftcopy.FileName, 3))
            
            
            If FileId <> 0 Then
                rst.Close()
                rst.Open("select softcopy, filetype from filetracker.lettermaster where id=" & FileId, cnn, 1, 2)
               
                Dim flen As Integer
                flen = txsoftcopy.FileBytes.Length
                If flen < 1000000 Then
                    rst(0).Value = txsoftcopy.FileBytes
                    rst.Update()
                Else
                    rst(1).Value = txsoftcopy.FileBytes
                    rst.Update()
                End If
                If BID.Value = 0 Then
                    Select Case txFILED.SelectedItem.Text
                        Case "Send"
                            cnn.Execute("insert into lettertrans (file_letter, letter_office_code, letter_diary_no, diary_no, office_code, receipt_date, receipt_time,  receipt_flag, transit_flag, receipt_date_time, is_new, ad_file_code, ns_file_code, next_office_code, desp_date, desp_time, desp_flag, next_office_receipt_status, despatch_date_time)  values('" & "L" & "', '" & office98 & "', '" & diaryno & "', '" & diaryno & "', '" & office98 & "', sysdate , sysdate , '" & "1" & "', '" & "1" & "',sysdate , '" & "1" & "', '" & "S" & "', '" & "SL" & "','" & BOfficeFile.SelectedValue & "',sysdate,sysdate, '" & "1" & "', '" & "0" & "',sysdate )")
                        Case "Nothing"
                            cnn.Execute("insert into lettertrans (file_letter, letter_office_code, letter_diary_no, diary_no, office_code, receipt_date, receipt_time,  receipt_flag, transit_flag, receipt_date_time, is_new, ad_file_code, ns_file_code,next_office_receipt_status)  values('" & "L" & "', '" & office98 & "', '" & diaryno & "', '" & diaryno & "', '" & office98 & "',sysdate,sysdate, '" & "1" & "', '" & "1" & "',sysdate, '" & "1" & "', '" & "S" & "', '" & "SL" & "' ,'0')")
                    End Select
                    diarynoNum = Right(diaryno, Len(CStr(diaryno)) - 1)
    		
                    cnn.Execute("update offices set letter_current_diary_no = " & diarynoNum & " where office_code = '" & office98 & "'")
                    
                End If
                
                msgtd.Text = "Records saved successfully. ID: " & FileId & " File diary No : " & diaryno
                txletter_no.Text = ""
                txsender_date.Text = Date.Today.ToShortDateString
                txsender.Text = ""
                txsubject.Text = ""
                txother_details.Text = ""
                
            Else
                msgtd.Text = "Records could not be saved. Error: " & Err.Description
                
            End If
        End Sub
    
        Protected Sub txFILED_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
            Select Case txFILED.SelectedItem.Text
                
                Case "Nothing"
                    Bofficefile.Visible = False
                    
                Case "Send"
                    Dim sqll As String = ""
                    sqll = "select 0, disp_office_code as office_code, (select office_name from offices where office_code=disp_office_code) as office_name from disp_offices where office_code='" & office98 & "' and disp_office_code in (select office_code from offices where office_level<>'STOP') order by id"
           
                    RStoCombo(sqll, 2, 1, BOfficeFile, "")
                    BOfficeFile.Visible = True
                    
                Case "File"
                    RStoCombo("select chg_filename from filemaster where filemaster.DEPARTMENT_CODE='" & dept98 & "' and filemaster.SECTION_CODE='" & section98 & "' ", 0, 0, Bofficefile, "")
                    Bofficefile.Visible = True
            End Select
        End Sub
    
        Protected Sub txIS_VIP_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
            If txIS_VIP.SelectedValue = 1 Then
                txVIP_CATAGORY.Visible = True
            Else
                txVIP_CATAGORY.Visible = False
                txVIP_CATAGORY.SelectedIndex = 0
    
            End If
            
    
        End Sub
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
           <title>File Tracker >> Letter >> New Letter Receipts</title>
        <link rel="Stylesheet" href="../inc/htmlstyle.css" />
        <script type="text/javascript" language="javascript" src="../inc/script.js"></script>
              <link type="text/css" rel="stylesheet" href="../file/inc/wioc_rich.css" />
    <%--<link href="../file/inc/hi_style.css" rel="stylesheet" type="text/css" />--%>
    <script language="javascript" src="../file/inc/main.js?ver=v11&pg=EDITOR"></script>
    <script type="text/javascript" src="../file/inc/resource_HI.js?ver=v11"></script>
    <script type="text/javascript" src="../file/inc/wioc_rich_action.js?ver=v11"></script>
    <script type="text/javascript" src="../file/inc/wioc_rich.js?ver=v11"></script>
    <script type="text/javascript"> 
    var rich = null;
    window.onload = function(){
    try{
    		loadControl('EN');
    	}catch(e){}
    	
    //	document.getElementById('showbutton').style.display='block';
    //	document.getElementById('wordsugg').style.display='block';
    };
    function _wiocRichControlSetProperties(obj){
    	try{
    		obj.setDictOn(true);
    	}catch(err){
    		alert(err);
    	}
    }
    function loadControl(lan){
    	if (lan=='HI')
    	{
    	try{
    		rich = new WiocRich('660px','80px','hello','txfile_subject','HI','R'            ,1,'');
    		rich.setHtml(document.forms[0]['txsubject'].value);
    	}catch(e){}
    	}
    	else
    	{
    	try{
    		rich = new WiocRich('660px','80px','hello','txfile_subject','EN','R'            ,1,'');
    		rich.setHtml(document.forms[0]['txsubject'].value);
    	}catch(e){}
    	}
    }
    function saveControl()
    {
    	document.forms[0]['txsubject'].value= rich.getHtml();
    }
    function changeLanguage(id)
    {
    	var chek = document.getElementById('chk_color');
    	
    	//chek.checked=false;
    	if (id.checked)
    	{
    	saveControl();
    	loadControl('HI');
    	
    	
    	}
    	else
    	{
    	saveControl();
    	loadControl('EN');
    	
    	}
    
    
    }
    </script> 
           
    </head>
    <body topmargin="0">
        <form id="form1" runat="server">
        <div>
        <asp:HiddenField ID="BID" runat="server" Value="0" />
        
        <table border="0" style="border-collapse: collapse" width="100%" id="table1">
    		<tr>
    			<td>
    			<font size="5" color="#5ED548"><b>New Letter Receipt</b></font></td>
    		</tr>
    		<tr>
    			<td height="189">
    			<table border="0" style="border-collapse: collapse" width="840" id="table2" bordercolor="#008000" height="199">
    				<tr>
    					<td style="border-style: solid; border-width: 1px" height="152">
    						<div align="center">
    							<table border="0" cellpadding="0" style="border-collapse: collapse" width="100%" height="49" id="table3">
    								<tr>
    									<td width="25%" height="25" align="left"></td>
    									<td width="24%" height="25" align="left">
                                            </td>
    									<td height="25" align="left"></td>
    									<td width="37%" height="25" align="left">
                                            <asp:TextBox ID="txIS_IMPORTANT" runat="server" CssClass="tx" Width="0px" Enabled=false >0</asp:TextBox></td>
    								</tr>
    								<tr>
    									<td width="25%" height="24" align="left">&nbsp; 
    									Letter No.</td>
    									<td width="24%" height="24" align="left">
    									&nbsp;<asp:TextBox ID="txletter_no" runat="server" CssClass="tx" Width="84px"></asp:TextBox></td>
    									<td height="24" align="left">
    									Date</td>
    									<td width="37%" height="24" align="left">
                                            <asp:TextBox ID="txsender_date" runat="server" CssClass="tx" Width="84px"></asp:TextBox></td>
    								</tr>
    								
    								<tr>
    									<td width="25%" height="24" align="left">&nbsp; 
    									Letter From</td>
    									<td width="75%" height="24" colspan="3" align="left">
    									&nbsp;<asp:TextBox ID="txsender" runat="server" CssClass="tx" Width="396px"></asp:TextBox></td>
    									
    								</tr>
    								<tr>
    									<td width="25%" height="24" align="left">&nbsp; Letter To 
    									</td>
    									<td width="75%" height="24" colspan="3" align="left">
    									&nbsp;<asp:DropDownList ID="txother_details" runat="server" CssClass="tx" Width="396px" AutoPostBack="False">
                                            </asp:DropDownList></td>
    								</tr>
    								<tr>
    									<td width="25%" height="24" align="left">&nbsp; 
    									Subject<br /> <input type="checkbox"  onclick   ="javascript:changeLanguage(this);" id="chk_color" name="chk_color" value=1 >Hindi<br />
                                            <p class="style1">(Max Length 100 Characters Only)</p></td>
    									<td width="75%" height="24" colspan="3" align="left"><asp:TextBox  ID="txsubject" runat="server"   CssClass="tx" Width="0px" 
                                                style="OVERFLOW: hidden;" Height="15px" TextMode="SingleLine" MaxLength="300"></asp:TextBox>
    									<span align="center" id="hello" tabindex="1" class="getfont_2" >
                        <div style="padding-top:60px;text-align:center;" >
    						<img align="absmiddle" src="../file/inc/ajax-loader1.gif" /></div>
                        </span></td>
    								
    								</tr>
    								<%--<tr>
    									<td width="19%" height="24" align="left">&nbsp; Other 
    									Details</td>
    									<td width="82%" height="24" colspan="4" align="left">
    									&nbsp;<asp:TextBox ID="txother_details" runat="server" CssClass="tx" Width="396px"></asp:TextBox></td>
    								</tr>--%>
    								<tr>
    									<td width="101%" height="24" align="left" colspan="4">
    									<table border="0" style="border-collapse: collapse" width="100%" id="table4">
    										<tr>
    											<td style="width: 206px">&nbsp;What to do</td>
    											<td style="width: 181px">&nbsp; <asp:DropDownList ID="txFILED" runat="server" CssClass="tx" OnSelectedIndexChanged="txFILED_SelectedIndexChanged" AutoPostBack="True">
                                                        <asp:ListItem>Nothing</asp:ListItem>
                                                        <asp:ListItem Value="0">Send</asp:ListItem>
                                                        <asp:ListItem Value="1">File</asp:ListItem>
                                                    </asp:DropDownList></td>
    											<td style="width: 65px" colspan="2"><asp:DropDownList ID="BOfficeFile" runat="server" CssClass="tx" Width="268px" Visible="False">
                                            </asp:DropDownList></td>
    											<td>&nbsp;</td>
    											<td>&nbsp;</td>
    										</tr>
    									</table>
    									</td>
    									</tr>
                                    <tr>
                                        <td align="left" width="25%" style="height: 24px">
    																	&nbsp;Important?</td>
                                        <td align="left" colspan="3" style="height: 24px">
                                            <table border="0" style="border-collapse: collapse" width="100%" id="table5">
    											<tr>
    												<td style="width: 47px"><asp:DropDownList ID="txIS_VIP" runat="server" CssClass="tx" OnSelectedIndexChanged="txIS_VIP_SelectedIndexChanged" AutoPostBack="True">
                                                <asp:ListItem Value="0">No</asp:ListItem>
                                                <asp:ListItem Value="1">Yes</asp:ListItem>
                                            </asp:DropDownList></td>
    												<td>&nbsp;<asp:DropDownList ID="txVIP_CATAGORY" runat="server" CssClass="tx" Width="268px" Visible="False">
                                                    </asp:DropDownList></td>
    											</tr>
    										</table>
    									</td>
                                    </tr>
    								<tr>
    									<td width="25%" height="24" align="left">&nbsp; Soft Copy File</td>
    									<td width="75%" height="24" colspan="3" align="left">
    									&nbsp;<asp:FileUpload ID="txsoftcopy" runat="server" Width="390px" /></td>
    								</tr>
    							</table>
    						</div>
    						</td>
    				</tr>
    				<tr>
    					<td style="border-style: solid; border-width: 1px; text-align: center;" background="../images/bg6.gif">&nbsp;<asp:Button 
                                ID="btSave" runat="server" Text="Save" OnClientClick="saveControl()" 
                                OnClick="btSave_Click" style="height: 26px" />
                        </td>
    				</tr>
    			</table>
    			</td>
    		</tr>
    		<tr>
    			<td><asp:Label ID="msgtd" runat="server" ForeColor="Red"></asp:Label></td>
    		</tr>
    	</table>
    	<p>
        
        </div>
        <table width="100%" ><tr>
    			<td style="border-style: solid; border-width: 1px; margin-left: 10; margin-right: 10" valign="top" width="100%" height="240"><div align=center>
    			<%
    			    DBInit()
    			    If Request("op1") = "del" Then
    			        cnn.Execute("delete from lettermaster where id=" & Request("id"))
    			        Response.Write("Letter deleted successfully.")
    			    End If
    			    'op = Request.QueryString("op")
    			    category = Request.QueryString("category")
    			    cat = IIf(Request.QueryString("category") = "", "is null", "='" & Request.QueryString("category") & "'")
    			    'B_go = Request.QueryString("B_go")
    			    'REGSQL = "select decode(filetype,null,'.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;|&nbsp;<a href=""?op1=del'||'&'||'id='||ID||'"" onclick=""return window.confirm(''Are you sure to delete this Letter. This can not be reverted.'')"">Delete</a>','<a href=""../inc/getfile.aspx?id='||id||'&'||'doctype='||lettermaster.filetype||'&'||'file=filetracker.lettermaster-softcopy"" target=_blank>Download</a>&nbsp;|&nbsp;<a href=""?op1=del'||'&'||'id='||ID||'"" onclick=""return window.confirm(''Are you sure to delete this Letter. This can not be reverted.'')"">Delete</a>') as ""_"", id as ""Ref No"", '<a href=""frmlettertrack.aspx?office_code='||office_code||'&'||'diaryno='||diary_no||'"">'||letter_no||'</a>' as ""Letter No"", sender_date as SDate, sender as ""Sent To"", subject from lettermaster where is_important='1' and office_Code in (select office_code from offices where department_code='" & dept98 & "') order by id desc"
    			    ' id in (select id from ( SELECT id,office_code, is_important, RANK() OVER (ORDER BY id DESC) as sal_rank  FROM lettermaster  where is_important='1' and office_Code in (select office_code from offices where department_code='" & dept98 & "')  WHERE sal_rank <= 3)
    			    
    			    REGSQL = "select decode(filetype,null,'.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;|&nbsp;<a href=""?op1=del'||'&'||'id='||ID||'"" onclick=""return window.confirm(''Are you sure to delete this Letter. This can not be reverted.'')"">Delete</a>','<a href=""../inc/getfile.aspx?id='||id||'&'||'doctype='||lettermaster.filetype||'&'||'file=filetracker.lettermaster-softcopy"" target=_blank>Download</a>&nbsp;|&nbsp;<a href=""?op1=del'||'&'||'id='||ID||'"" onclick=""return window.confirm(''Are you sure to delete this Letter. This can not be reverted.'')"">Delete</a>') as ""_"", id as ""Ref No"", '<a href=""frmlettertrack.aspx?office_code='||office_code||'&'||'diaryno='||diary_no||'"">'||letter_no||'</a>' as ""Letter No"", sender_date as SDate, sender as ""Letter From"",(select office_name from offices where office_code=other_details) as ""Letter To"", subject from lettermaster where id in (select id from ( SELECT id,office_code, is_important, RANK() OVER (ORDER BY id DESC) as sal_rank  FROM lettermaster where is_important='0' and office_Code ='" & office98 & "'    ) where sal_rank<=10) "
    			    'Response.Write(REGSQL)
    			    
    			    
    			    
    			    
    			    
    			    
    			    RStoTable(REGSQL, "LETTERS " & IIf(category <> "", " (CATEGORY: " & UCase(category) & ")", "") & ";impletters;impletters", "100%;400", 5, 15, -1, "10;8;8;10;10;10", "")
    
    %></div>
    			</td></tr> </table>
        </form>
    </body>
    </html>

    Monday, August 5, 2013 2:33 AM
  • User442781244 posted

    hi

    rahul

    i have some problem in code. your suggestion i have already completed.

    <%@ Page Language="VB" AspCompat="true" Explicit="false" EnableEventValidation="false" Inherits="myPage" %>
    <%--<%@ Import namespace="ADODB" %><%  RStoTablePre()%>--%>
    <script runat="server">   
    
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
            If Request("op") = "open" Then
                BID.Value = openRecords("LETTERMASTER", " ID=" & Request("ID"))
                
            End If
        End Sub
    
        Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs)
            On Error Resume Next
            
            DBInit()
            Err.Clear()
            'response.write("Select department_code,department_name from departments where department_code='" & dept98 & "'")
            RStoCombo("select distinct vip_catagory from lettermaster  where office_code in (select OFFICE_CODE from offices where DEPARTMENT_CODE='" & dept98 & "')", 0, 0, txVIP_CATAGORY, "")
            txsender_date.Text = Date.Today.ToShortDateString
            txVIP_CATAGORY.Attributes.Add("onhelp", "var new_vh=window.prompt('Enter the New Catagory Name','');if ((new_vh!='')&&(new_vh!=null)) {var vopt;vopt=this; vopt.options[vopt.length]=new Option(new_vh,new_vh,vopt.defaultSelected,true)}return(false);")
            RStoCombo("Select office_name, office_code from offices where department_code='" & dept98 & "' order by 1", 0, 1, txother_details, "")
    
        End Sub
    
    
        Protected Sub btSave_Click(ByVal sender As Object, ByVal e As System.EventArgs)
           On Error Resume Next
            
            Dim exFld As String = "", exVal As String = ""
            diaryno = getdiarynol()
            response.write (diaryno)
            Select Case txFILED.SelectedItem.Text
                
                Case "Nothing"
                Case "Send"
                    exFld = exFld & "disp_office_code;"
                    exVal = exVal & BOfficeFile.Text & ";"
                Case "File"
                    exFld = exFld & "file_Code;"
                    exVal = exVal & BOfficeFile.Text & ";"
            End Select
    
            err.clear
            
            FileId = SaveData("filetracker.LETTERMASTER", " ID=" & BID.Value, exFld & "OFFICE_CODE;DIARY_NO;USER_CODE;FILETYPE", exVal & office98 & ";" & diaryno & ";" & user98 & ";" & Right(txsoftcopy.FileName, 3))
            
            
            If FileId <> 0 Then
                rst.Close()
                rst.Open("select softcopy, filetype from filetracker.lettermaster where id=" & FileId, cnn, 1, 2)
               
                Dim flen As Integer
                flen = txsoftcopy.FileBytes.Length
                If flen < 1000000 Then
                    rst(0).Value = txsoftcopy.FileBytes
                    rst.Update()
                Else
                    rst(1).Value = txsoftcopy.FileBytes
                    rst.Update()
                End If
                If BID.Value = 0 Then
                    Select Case txFILED.SelectedItem.Text
                        Case "Send"
                            cnn.Execute("insert into lettertrans (file_letter, letter_office_code, letter_diary_no, diary_no, office_code, receipt_date, receipt_time,  receipt_flag, transit_flag, receipt_date_time, is_new, ad_file_code, ns_file_code, next_office_code, desp_date, desp_time, desp_flag, next_office_receipt_status, despatch_date_time)  values('" & "L" & "', '" & office98 & "', '" & diaryno & "', '" & diaryno & "', '" & office98 & "', sysdate , sysdate , '" & "1" & "', '" & "1" & "',sysdate , '" & "1" & "', '" & "S" & "', '" & "SL" & "','" & BOfficeFile.SelectedValue & "',sysdate,sysdate, '" & "1" & "', '" & "0" & "',sysdate )")
                        Case "Nothing"
                            cnn.Execute("insert into lettertrans (file_letter, letter_office_code, letter_diary_no, diary_no, office_code, receipt_date, receipt_time,  receipt_flag, transit_flag, receipt_date_time, is_new, ad_file_code, ns_file_code,next_office_receipt_status)  values('" & "L" & "', '" & office98 & "', '" & diaryno & "', '" & diaryno & "', '" & office98 & "',sysdate,sysdate, '" & "1" & "', '" & "1" & "',sysdate, '" & "1" & "', '" & "S" & "', '" & "SL" & "' ,'0')")
                    End Select
                    diarynoNum = Right(diaryno, Len(CStr(diaryno)) - 1)
    		
                    cnn.Execute("update offices set letter_current_diary_no = " & diarynoNum & " where office_code = '" & office98 & "'")
                    
                End If
                
                msgtd.Text = "Records saved successfully. ID: " & FileId & " File diary No : " & diaryno
                txletter_no.Text = ""
                txsender_date.Text = Date.Today.ToShortDateString
                txsender.Text = ""
                txsubject.Text = ""
                txother_details.Text = ""
                
            Else
                msgtd.Text = "Records could not be saved. Error: " & Err.Description
                
            End If
        End Sub
    
        Protected Sub txFILED_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
            Select Case txFILED.SelectedItem.Text
                
                Case "Nothing"
                    Bofficefile.Visible = False
                    
                Case "Send"
                    Dim sqll As String = ""
                    sqll = "select 0, disp_office_code as office_code, (select office_name from offices where office_code=disp_office_code) as office_name from disp_offices where office_code='" & office98 & "' and disp_office_code in (select office_code from offices where office_level<>'STOP') order by id"
           
                    RStoCombo(sqll, 2, 1, BOfficeFile, "")
                    BOfficeFile.Visible = True
                    
                Case "File"
                    RStoCombo("select chg_filename from filemaster where filemaster.DEPARTMENT_CODE='" & dept98 & "' and filemaster.SECTION_CODE='" & section98 & "' ", 0, 0, Bofficefile, "")
                    Bofficefile.Visible = True
            End Select
        End Sub
    
        Protected Sub txIS_VIP_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
            If txIS_VIP.SelectedValue = 1 Then
                txVIP_CATAGORY.Visible = True
            Else
                txVIP_CATAGORY.Visible = False
                txVIP_CATAGORY.SelectedIndex = 0
    
            End If
            
    
        End Sub
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
           <title>File Tracker >> Letter >> New Letter Receipts</title>
        <link rel="Stylesheet" href="../inc/htmlstyle.css" />
        <script type="text/javascript" language="javascript" src="../inc/script.js"></script>
              <link type="text/css" rel="stylesheet" href="../file/inc/wioc_rich.css" />
    <%--<link href="../file/inc/hi_style.css" rel="stylesheet" type="text/css" />--%>
    <script language="javascript" src="../file/inc/main.js?ver=v11&pg=EDITOR"></script>
    <script type="text/javascript" src="../file/inc/resource_HI.js?ver=v11"></script>
    <script type="text/javascript" src="../file/inc/wioc_rich_action.js?ver=v11"></script>
    <script type="text/javascript" src="../file/inc/wioc_rich.js?ver=v11"></script>
    <script type="text/javascript"> 
    var rich = null;
    window.onload = function(){
    try{
    		loadControl('EN');
    	}catch(e){}
    	
    //	document.getElementById('showbutton').style.display='block';
    //	document.getElementById('wordsugg').style.display='block';
    };
    function _wiocRichControlSetProperties(obj){
    	try{
    		obj.setDictOn(true);
    	}catch(err){
    		alert(err);
    	}
    }
    function loadControl(lan){
    	if (lan=='HI')
    	{
    	try{
    		rich = new WiocRich('660px','80px','hello','txfile_subject','HI','R'            ,1,'');
    		rich.setHtml(document.forms[0]['txsubject'].value);
    	}catch(e){}
    	}
    	else
    	{
    	try{
    		rich = new WiocRich('660px','80px','hello','txfile_subject','EN','R'            ,1,'');
    		rich.setHtml(document.forms[0]['txsubject'].value);
    	}catch(e){}
    	}
    }
    function saveControl()
    {
    	document.forms[0]['txsubject'].value= rich.getHtml();
    }
    function changeLanguage(id)
    {
    	var chek = document.getElementById('chk_color');
    	
    	//chek.checked=false;
    	if (id.checked)
    	{
    	saveControl();
    	loadControl('HI');
    	
    	
    	}
    	else
    	{
    	saveControl();
    	loadControl('EN');
    	
    	}
    
    
    }
    </script> 
           
    </head>
    <body topmargin="0">
        <form id="form1" runat="server">
        <div>
        <asp:HiddenField ID="BID" runat="server" Value="0" />
        
        <table border="0" style="border-collapse: collapse" width="100%" id="table1">
    		<tr>
    			<td>
    			<font size="5" color="#5ED548"><b>New Letter Receipt</b></font></td>
    		</tr>
    		<tr>
    			<td height="189">
    			<table border="0" style="border-collapse: collapse" width="840" id="table2" bordercolor="#008000" height="199">
    				<tr>
    					<td style="border-style: solid; border-width: 1px" height="152">
    						<div align="center">
    							<table border="0" cellpadding="0" style="border-collapse: collapse" width="100%" height="49" id="table3">
    								<tr>
    									<td width="25%" height="25" align="left"></td>
    									<td width="24%" height="25" align="left">
                                            </td>
    									<td height="25" align="left"></td>
    									<td width="37%" height="25" align="left">
                                            <asp:TextBox ID="txIS_IMPORTANT" runat="server" CssClass="tx" Width="0px" Enabled=false >0</asp:TextBox></td>
    								</tr>
    								<tr>
    									<td width="25%" height="24" align="left">&nbsp; 
    									Letter No.</td>
    									<td width="24%" height="24" align="left">
    									&nbsp;<asp:TextBox ID="txletter_no" runat="server" CssClass="tx" Width="84px"></asp:TextBox></td>
    									<td height="24" align="left">
    									Date</td>
    									<td width="37%" height="24" align="left">
                                            <asp:TextBox ID="txsender_date" runat="server" CssClass="tx" Width="84px"></asp:TextBox></td>
    								</tr>
    								
    								<tr>
    									<td width="25%" height="24" align="left">&nbsp; 
    									Letter From</td>
    									<td width="75%" height="24" colspan="3" align="left">
    									&nbsp;<asp:TextBox ID="txsender" runat="server" CssClass="tx" Width="396px"></asp:TextBox></td>
    									
    								</tr>
    								<tr>
    									<td width="25%" height="24" align="left">&nbsp; Letter To 
    									</td>
    									<td width="75%" height="24" colspan="3" align="left">
    									&nbsp;<asp:DropDownList ID="txother_details" runat="server" CssClass="tx" Width="396px" AutoPostBack="False">
                                            </asp:DropDownList></td>
    								</tr>
    								<tr>
    									<td width="25%" height="24" align="left">&nbsp; 
    									Subject<br /> <input type="checkbox"  onclick   ="javascript:changeLanguage(this);" id="chk_color" name="chk_color" value=1 >Hindi<br />
                                            <p class="style1">(Max Length 100 Characters Only)</p></td>
    									<td width="75%" height="24" colspan="3" align="left"><asp:TextBox  ID="txsubject" runat="server"   CssClass="tx" Width="0px" 
                                                style="OVERFLOW: hidden;" Height="15px" TextMode="SingleLine" MaxLength="300"></asp:TextBox>
    									<span align="center" id="hello" tabindex="1" class="getfont_2" >
                        <div style="padding-top:60px;text-align:center;" >
    						<img align="absmiddle" src="../file/inc/ajax-loader1.gif" /></div>
                        </span></td>
    								
    								</tr>
    								<%--<tr>
    									<td width="19%" height="24" align="left">&nbsp; Other 
    									Details</td>
    									<td width="82%" height="24" colspan="4" align="left">
    									&nbsp;<asp:TextBox ID="txother_details" runat="server" CssClass="tx" Width="396px"></asp:TextBox></td>
    								</tr>--%>
    								<tr>
    									<td width="101%" height="24" align="left" colspan="4">
    									<table border="0" style="border-collapse: collapse" width="100%" id="table4">
    										<tr>
    											<td style="width: 206px">&nbsp;What to do</td>
    											<td style="width: 181px">&nbsp; <asp:DropDownList ID="txFILED" runat="server" CssClass="tx" OnSelectedIndexChanged="txFILED_SelectedIndexChanged" AutoPostBack="True">
                                                        <asp:ListItem>Nothing</asp:ListItem>
                                                        <asp:ListItem Value="0">Send</asp:ListItem>
                                                        <asp:ListItem Value="1">File</asp:ListItem>
                                                    </asp:DropDownList></td>
    											<td style="width: 65px" colspan="2"><asp:DropDownList ID="BOfficeFile" runat="server" CssClass="tx" Width="268px" Visible="False">
                                            </asp:DropDownList></td>
    											<td>&nbsp;</td>
    											<td>&nbsp;</td>
    										</tr>
    									</table>
    									</td>
    									</tr>
                                    <tr>
                                        <td align="left" width="25%" style="height: 24px">
    																	&nbsp;Important?</td>
                                        <td align="left" colspan="3" style="height: 24px">
                                            <table border="0" style="border-collapse: collapse" width="100%" id="table5">
    											<tr>
    												<td style="width: 47px"><asp:DropDownList ID="txIS_VIP" runat="server" CssClass="tx" OnSelectedIndexChanged="txIS_VIP_SelectedIndexChanged" AutoPostBack="True">
                                                <asp:ListItem Value="0">No</asp:ListItem>
                                                <asp:ListItem Value="1">Yes</asp:ListItem>
                                            </asp:DropDownList></td>
    												<td>&nbsp;<asp:DropDownList ID="txVIP_CATAGORY" runat="server" CssClass="tx" Width="268px" Visible="False">
                                                    </asp:DropDownList></td>
    											</tr>
    										</table>
    									</td>
                                    </tr>
    								<tr>
    									<td width="25%" height="24" align="left">&nbsp; Soft Copy File</td>
    									<td width="75%" height="24" colspan="3" align="left">
    									&nbsp;<asp:FileUpload ID="txsoftcopy" runat="server" Width="390px" /></td>
    								</tr>
    							</table>
    						</div>
    						</td>
    				</tr>
    				<tr>
    					<td style="border-style: solid; border-width: 1px; text-align: center;" background="../images/bg6.gif">&nbsp;<asp:Button 
                                ID="btSave" runat="server" Text="Save" OnClientClick="saveControl()" 
                                OnClick="btSave_Click" style="height: 26px" />
                        </td>
    				</tr>
    			</table>
    			</td>
    		</tr>
    		<tr>
    			<td><asp:Label ID="msgtd" runat="server" ForeColor="Red"></asp:Label></td>
    		</tr>
    	</table>
    	<p>
        
        </div>
        <table width="100%" ><tr>
    			<td style="border-style: solid; border-width: 1px; margin-left: 10; margin-right: 10" valign="top" width="100%" height="240"><div align=center>
    			<%
    			    DBInit()
    			    If Request("op1") = "del" Then
    			        cnn.Execute("delete from lettermaster where id=" & Request("id"))
    			        Response.Write("Letter deleted successfully.")
    			    End If
    			    'op = Request.QueryString("op")
    			    category = Request.QueryString("category")
    			    cat = IIf(Request.QueryString("category") = "", "is null", "='" & Request.QueryString("category") & "'")
    			    'B_go = Request.QueryString("B_go")
    			    'REGSQL = "select decode(filetype,null,'.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;|&nbsp;<a href=""?op1=del'||'&'||'id='||ID||'"" onclick=""return window.confirm(''Are you sure to delete this Letter. This can not be reverted.'')"">Delete</a>','<a href=""../inc/getfile.aspx?id='||id||'&'||'doctype='||lettermaster.filetype||'&'||'file=filetracker.lettermaster-softcopy"" target=_blank>Download</a>&nbsp;|&nbsp;<a href=""?op1=del'||'&'||'id='||ID||'"" onclick=""return window.confirm(''Are you sure to delete this Letter. This can not be reverted.'')"">Delete</a>') as ""_"", id as ""Ref No"", '<a href=""frmlettertrack.aspx?office_code='||office_code||'&'||'diaryno='||diary_no||'"">'||letter_no||'</a>' as ""Letter No"", sender_date as SDate, sender as ""Sent To"", subject from lettermaster where is_important='1' and office_Code in (select office_code from offices where department_code='" & dept98 & "') order by id desc"
    			    ' id in (select id from ( SELECT id,office_code, is_important, RANK() OVER (ORDER BY id DESC) as sal_rank  FROM lettermaster  where is_important='1' and office_Code in (select office_code from offices where department_code='" & dept98 & "')  WHERE sal_rank <= 3)
    			    
    			    REGSQL = "select decode(filetype,null,'.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;|&nbsp;<a href=""?op1=del'||'&'||'id='||ID||'"" onclick=""return window.confirm(''Are you sure to delete this Letter. This can not be reverted.'')"">Delete</a>','<a href=""../inc/getfile.aspx?id='||id||'&'||'doctype='||lettermaster.filetype||'&'||'file=filetracker.lettermaster-softcopy"" target=_blank>Download</a>&nbsp;|&nbsp;<a href=""?op1=del'||'&'||'id='||ID||'"" onclick=""return window.confirm(''Are you sure to delete this Letter. This can not be reverted.'')"">Delete</a>') as ""_"", id as ""Ref No"", '<a href=""frmlettertrack.aspx?office_code='||office_code||'&'||'diaryno='||diary_no||'"">'||letter_no||'</a>' as ""Letter No"", sender_date as SDate, sender as ""Letter From"",(select office_name from offices where office_code=other_details) as ""Letter To"", subject from lettermaster where id in (select id from ( SELECT id,office_code, is_important, RANK() OVER (ORDER BY id DESC) as sal_rank  FROM lettermaster where is_important='0' and office_Code ='" & office98 & "'    ) where sal_rank<=10) "
    			    'Response.Write(REGSQL)
    			    
    			    
    			    
    			    
    			    
    			    
    			    RStoTable(REGSQL, "LETTERS " & IIf(category <> "", " (CATEGORY: " & UCase(category) & ")", "") & ";impletters;impletters", "100%;400", 5, 15, -1, "10;8;8;10;10;10", "")
    
    %></div>
    			</td></tr> </table>
        </form>
    </body>
    </html>



    Monday, August 5, 2013 2:36 AM
  • User-1716253493 posted

    To change up to about 20mb try this

    If flen < 20000000 Then
    .
    .
    .

    Assume 2000000 bytes = 20000 kilo bytes = 20 mega byte

    This is not actual value because 1 kilo bytes = 1024 byte

    Monday, August 5, 2013 2:42 AM
  • User442781244 posted

    hi

    oned_gk

    i want 1gb. then what i have to change???? kindly assist

    Monday, August 5, 2013 2:44 AM
  • User-1716253493 posted

    1 gb = 1000 mb (1024 mb)

    you can set to 1000000000 or 1073741824

    If flen < 1073741824 Then

    Make sure the web.config also allow the size

    http://www.smartftp.com/support/kb/bits-bytes-mega-giga-tera-f53.html

    Monday, August 5, 2013 2:53 AM
  • User442781244 posted

    hhi

    oned_gk

    when i am downloading..i am getting doc in correct form..kindly see code.web.config 1gb limit is given.

    kindly see code carefully and suggest me

    <%@ Page Language="VB" AspCompat="true" Explicit="false" EnableEventValidation="false" Inherits="myPage" %>
    <%--<%@ Import namespace="ADODB" %><%  RStoTablePre()%>--%>
    <script runat="server">   
    
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
            If Request("op") = "open" Then
                BID.Value = openRecords("LETTERMASTER", " ID=" & Request("ID"))
                
            End If
        End Sub
    
        Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs)
            On Error Resume Next
            
            DBInit()
            Err.Clear()
            'response.write("Select department_code,department_name from departments where department_code='" & dept98 & "'")
            RStoCombo("select distinct vip_catagory from lettermaster  where office_code in (select OFFICE_CODE from offices where DEPARTMENT_CODE='" & dept98 & "')", 0, 0, txVIP_CATAGORY, "")
            txsender_date.Text = Date.Today.ToShortDateString
            txVIP_CATAGORY.Attributes.Add("onhelp", "var new_vh=window.prompt('Enter the New Catagory Name','');if ((new_vh!='')&&(new_vh!=null)) {var vopt;vopt=this; vopt.options[vopt.length]=new Option(new_vh,new_vh,vopt.defaultSelected,true)}return(false);")
            RStoCombo("Select office_name, office_code from offices where department_code='" & dept98 & "' order by 1", 0, 1, txother_details, "")
    
        End Sub
    
    
        Protected Sub btSave_Click(ByVal sender As Object, ByVal e As System.EventArgs)
           On Error Resume Next
            
            Dim exFld As String = "", exVal As String = ""
            diaryno = getdiarynol()
            response.write (diaryno)
            Select Case txFILED.SelectedItem.Text
                
                Case "Nothing"
                Case "Send"
                    exFld = exFld & "disp_office_code;"
                    exVal = exVal & BOfficeFile.Text & ";"
                Case "File"
                    exFld = exFld & "file_Code;"
                    exVal = exVal & BOfficeFile.Text & ";"
            End Select
    
            err.clear
            
            FileId = SaveData("filetracker.LETTERMASTER", " ID=" & BID.Value, exFld & "OFFICE_CODE;DIARY_NO;USER_CODE;FILETYPE", exVal & office98 & ";" & diaryno & ";" & user98 & ";" & Right(txsoftcopy.FileName, 3))
            
            
            If FileId <> 0 Then
                rst.Close()
                rst.Open("select softcopy, filetype from filetracker.lettermaster where id=" & FileId, cnn, 1, 2)
               
                Dim flen As Integer
                flen = txsoftcopy.FileBytes.Length
                If flen < 20000000 Then
                    rst(0).Value = txsoftcopy.FileBytes
                    rst.Update()
                Else
                    rst(1).Value = ""
                    rst.Update()
                End If
                If BID.Value = 0 Then
                    Select Case txFILED.SelectedItem.Text
                        Case "Send"
                            cnn.Execute("insert into lettertrans (file_letter, letter_office_code, letter_diary_no, diary_no, office_code, receipt_date, receipt_time,  receipt_flag, transit_flag, receipt_date_time, is_new, ad_file_code, ns_file_code, next_office_code, desp_date, desp_time, desp_flag, next_office_receipt_status, despatch_date_time)  values('" & "L" & "', '" & office98 & "', '" & diaryno & "', '" & diaryno & "', '" & office98 & "', sysdate , sysdate , '" & "1" & "', '" & "1" & "',sysdate , '" & "1" & "', '" & "S" & "', '" & "SL" & "','" & BOfficeFile.SelectedValue & "',sysdate,sysdate, '" & "1" & "', '" & "0" & "',sysdate )")
                        Case "Nothing"
                            cnn.Execute("insert into lettertrans (file_letter, letter_office_code, letter_diary_no, diary_no, office_code, receipt_date, receipt_time,  receipt_flag, transit_flag, receipt_date_time, is_new, ad_file_code, ns_file_code,next_office_receipt_status)  values('" & "L" & "', '" & office98 & "', '" & diaryno & "', '" & diaryno & "', '" & office98 & "',sysdate,sysdate, '" & "1" & "', '" & "1" & "',sysdate, '" & "1" & "', '" & "S" & "', '" & "SL" & "' ,'0')")
                    End Select
                    diarynoNum = Right(diaryno, Len(CStr(diaryno)) - 1)
    		
                    cnn.Execute("update offices set letter_current_diary_no = " & diarynoNum & " where office_code = '" & office98 & "'")
                    
                End If
                
                msgtd.Text = "Records saved successfully. ID: " & FileId & " File diary No : " & diaryno
                txletter_no.Text = ""
                txsender_date.Text = Date.Today.ToShortDateString
                txsender.Text = ""
                txsubject.Text = ""
                txother_details.Text = ""
                
            Else
                msgtd.Text = "Records could not be saved. Error: " & Err.Description
                
            End If
        End Sub
    
        Protected Sub txFILED_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
            Select Case txFILED.SelectedItem.Text
                
                Case "Nothing"
                    Bofficefile.Visible = False
                    
                Case "Send"
                    Dim sqll As String = ""
                    sqll = "select 0, disp_office_code as office_code, (select office_name from offices where office_code=disp_office_code) as office_name from disp_offices where office_code='" & office98 & "' and disp_office_code in (select office_code from offices where office_level<>'STOP') order by id"
           
                    RStoCombo(sqll, 2, 1, BOfficeFile, "")
                    BOfficeFile.Visible = True
                    
                Case "File"
                    RStoCombo("select chg_filename from filemaster where filemaster.DEPARTMENT_CODE='" & dept98 & "' and filemaster.SECTION_CODE='" & section98 & "' ", 0, 0, Bofficefile, "")
                    Bofficefile.Visible = True
            End Select
        End Sub
    
        Protected Sub txIS_VIP_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
            If txIS_VIP.SelectedValue = 1 Then
                txVIP_CATAGORY.Visible = True
            Else
                txVIP_CATAGORY.Visible = False
                txVIP_CATAGORY.SelectedIndex = 0
    
            End If
            
    
        End Sub
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
           <title>File Tracker >> Letter >> New Letter Receipts</title>
        <link rel="Stylesheet" href="../inc/htmlstyle.css" />
        <script type="text/javascript" language="javascript" src="../inc/script.js"></script>
              <link type="text/css" rel="stylesheet" href="../file/inc/wioc_rich.css" />
    <%--<link href="../file/inc/hi_style.css" rel="stylesheet" type="text/css" />--%>
    <script language="javascript" src="../file/inc/main.js?ver=v11&pg=EDITOR"></script>
    <script type="text/javascript" src="../file/inc/resource_HI.js?ver=v11"></script>
    <script type="text/javascript" src="../file/inc/wioc_rich_action.js?ver=v11"></script>
    <script type="text/javascript" src="../file/inc/wioc_rich.js?ver=v11"></script>
    <script type="text/javascript"> 
    var rich = null;
    window.onload = function(){
    try{
    		loadControl('EN');
    	}catch(e){}
    	
    //	document.getElementById('showbutton').style.display='block';
    //	document.getElementById('wordsugg').style.display='block';
    };
    function _wiocRichControlSetProperties(obj){
    	try{
    		obj.setDictOn(true);
    	}catch(err){
    		alert(err);
    	}
    }
    function loadControl(lan){
    	if (lan=='HI')
    	{
    	try{
    		rich = new WiocRich('660px','80px','hello','txfile_subject','HI','R'            ,1,'');
    		rich.setHtml(document.forms[0]['txsubject'].value);
    	}catch(e){}
    	}
    	else
    	{
    	try{
    		rich = new WiocRich('660px','80px','hello','txfile_subject','EN','R'            ,1,'');
    		rich.setHtml(document.forms[0]['txsubject'].value);
    	}catch(e){}
    	}
    }
    function saveControl()
    {
    	document.forms[0]['txsubject'].value= rich.getHtml();
    }
    function changeLanguage(id)
    {
    	var chek = document.getElementById('chk_color');
    	
    	//chek.checked=false;
    	if (id.checked)
    	{
    	saveControl();
    	loadControl('HI');
    	
    	
    	}
    	else
    	{
    	saveControl();
    	loadControl('EN');
    	
    	}
    
    
    }
    </script> 
           
    </head>
    <body topmargin="0">
        <form id="form1" runat="server">
        <div>
        <asp:HiddenField ID="BID" runat="server" Value="0" />
        
        <table border="0" style="border-collapse: collapse" width="100%" id="table1">
    		<tr>
    			<td>
    			<font size="5" color="#5ED548"><b>New Letter Receipt</b></font></td>
    		</tr>
    		<tr>
    			<td height="189">
    			<table border="0" style="border-collapse: collapse" width="840" id="table2" bordercolor="#008000" height="199">
    				<tr>
    					<td style="border-style: solid; border-width: 1px" height="152">
    						<div align="center">
    							<table border="0" cellpadding="0" style="border-collapse: collapse" width="100%" height="49" id="table3">
    								<tr>
    									<td width="25%" height="25" align="left"></td>
    									<td width="24%" height="25" align="left">
                                            </td>
    									<td height="25" align="left"></td>
    									<td width="37%" height="25" align="left">
                                            <asp:TextBox ID="txIS_IMPORTANT" runat="server" CssClass="tx" Width="0px" Enabled=false >0</asp:TextBox></td>
    								</tr>
    								<tr>
    									<td width="25%" height="24" align="left">&nbsp; 
    									Letter No.</td>
    									<td width="24%" height="24" align="left">
    									&nbsp;<asp:TextBox ID="txletter_no" runat="server" CssClass="tx" Width="84px"></asp:TextBox></td>
    									<td height="24" align="left">
    									Date</td>
    									<td width="37%" height="24" align="left">
                                            <asp:TextBox ID="txsender_date" runat="server" CssClass="tx" Width="84px"></asp:TextBox></td>
    								</tr>
    								
    								<tr>
    									<td width="25%" height="24" align="left">&nbsp; 
    									Letter From</td>
    									<td width="75%" height="24" colspan="3" align="left">
    									&nbsp;<asp:TextBox ID="txsender" runat="server" CssClass="tx" Width="396px"></asp:TextBox></td>
    									
    								</tr>
    								<tr>
    									<td width="25%" height="24" align="left">&nbsp; Letter To 
    									</td>
    									<td width="75%" height="24" colspan="3" align="left">
    									&nbsp;<asp:DropDownList ID="txother_details" runat="server" CssClass="tx" Width="396px" AutoPostBack="False">
                                            </asp:DropDownList></td>
    								</tr>
    								<tr>
    									<td width="25%" height="24" align="left">&nbsp; 
    									Subject<br /> <input type="checkbox"  onclick   ="javascript:changeLanguage(this);" id="chk_color" name="chk_color" value=1 >Hindi<br />
                                            <p class="style1">(Max Length 100 Characters Only)</p></td>
    									<td width="75%" height="24" colspan="3" align="left"><asp:TextBox  ID="txsubject" runat="server"   CssClass="tx" Width="0px" 
                                                style="OVERFLOW: hidden;" Height="15px" TextMode="SingleLine" MaxLength="300"></asp:TextBox>
    									<span align="center" id="hello" tabindex="1" class="getfont_2" >
                        <div style="padding-top:60px;text-align:center;" >
    						<img align="absmiddle" src="../file/inc/ajax-loader1.gif" /></div>
                        </span></td>
    								
    								</tr>
    								<%--<tr>
    									<td width="19%" height="24" align="left">&nbsp; Other 
    									Details</td>
    									<td width="82%" height="24" colspan="4" align="left">
    									&nbsp;<asp:TextBox ID="txother_details" runat="server" CssClass="tx" Width="396px"></asp:TextBox></td>
    								</tr>--%>
    								<tr>
    									<td width="101%" height="24" align="left" colspan="4">
    									<table border="0" style="border-collapse: collapse" width="100%" id="table4">
    										<tr>
    											<td style="width: 206px">&nbsp;What to do</td>
    											<td style="width: 181px">&nbsp; <asp:DropDownList ID="txFILED" runat="server" CssClass="tx" OnSelectedIndexChanged="txFILED_SelectedIndexChanged" AutoPostBack="True">
                                                        <asp:ListItem>Nothing</asp:ListItem>
                                                        <asp:ListItem Value="0">Send</asp:ListItem>
                                                        <asp:ListItem Value="1">File</asp:ListItem>
                                                    </asp:DropDownList></td>
    											<td style="width: 65px" colspan="2"><asp:DropDownList ID="BOfficeFile" runat="server" CssClass="tx" Width="268px" Visible="False">
                                            </asp:DropDownList></td>
    											<td>&nbsp;</td>
    											<td>&nbsp;</td>
    										</tr>
    									</table>
    									</td>
    									</tr>
                                    <tr>
                                        <td align="left" width="25%" style="height: 24px">
    																	&nbsp;Important?</td>
                                        <td align="left" colspan="3" style="height: 24px">
                                            <table border="0" style="border-collapse: collapse" width="100%" id="table5">
    											<tr>
    												<td style="width: 47px"><asp:DropDownList ID="txIS_VIP" runat="server" CssClass="tx" OnSelectedIndexChanged="txIS_VIP_SelectedIndexChanged" AutoPostBack="True">
                                                <asp:ListItem Value="0">No</asp:ListItem>
                                                <asp:ListItem Value="1">Yes</asp:ListItem>
                                            </asp:DropDownList></td>
    												<td>&nbsp;<asp:DropDownList ID="txVIP_CATAGORY" runat="server" CssClass="tx" Width="268px" Visible="False">
                                                    </asp:DropDownList></td>
    											</tr>
    										</table>
    									</td>
                                    </tr>
    								<tr>
    									<td width="25%" height="24" align="left">&nbsp; Soft Copy File</td>
    									<td width="75%" height="24" colspan="3" align="left">
    									&nbsp;<asp:FileUpload ID="txsoftcopy" runat="server" Width="390px" /></td>
    								</tr>
    							</table>
    						</div>
    						</td>
    				</tr>
    				<tr>
    					<td style="border-style: solid; border-width: 1px; text-align: center;" background="../images/bg6.gif">&nbsp;<asp:Button ID="btSave" runat="server" Text="Save" OnClientClick="saveControl()" OnClick="btSave_Click" />
                        </td>
    				</tr>
    			</table>
    			</td>
    		</tr>
    		<tr>
    			<td><asp:Label ID="msgtd" runat="server" ForeColor="Red"></asp:Label></td>
    		</tr>
    	</table>
    	<p>
        
        </div>
        <table width="100%" ><tr>
    			<td style="border-style: solid; border-width: 1px; margin-left: 10; margin-right: 10" valign="top" width="100%" height="240"><div align=center>
    			<%
    			    DBInit()
    			    If Request("op1") = "del" Then
    			        cnn.Execute("delete from lettermaster where id=" & Request("id"))
    			        Response.Write("Letter deleted successfully.")
    			    End If
    			    'op = Request.QueryString("op")
    			    category = Request.QueryString("category")
    			    cat = IIf(Request.QueryString("category") = "", "is null", "='" & Request.QueryString("category") & "'")
    			    'B_go = Request.QueryString("B_go")
    			    'REGSQL = "select decode(filetype,null,'.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;|&nbsp;<a href=""?op1=del'||'&'||'id='||ID||'"" onclick=""return window.confirm(''Are you sure to delete this Letter. This can not be reverted.'')"">Delete</a>','<a href=""../inc/getfile.aspx?id='||id||'&'||'doctype='||lettermaster.filetype||'&'||'file=filetracker.lettermaster-softcopy"" target=_blank>Download</a>&nbsp;|&nbsp;<a href=""?op1=del'||'&'||'id='||ID||'"" onclick=""return window.confirm(''Are you sure to delete this Letter. This can not be reverted.'')"">Delete</a>') as ""_"", id as ""Ref No"", '<a href=""frmlettertrack.aspx?office_code='||office_code||'&'||'diaryno='||diary_no||'"">'||letter_no||'</a>' as ""Letter No"", sender_date as SDate, sender as ""Sent To"", subject from lettermaster where is_important='1' and office_Code in (select office_code from offices where department_code='" & dept98 & "') order by id desc"
    			    ' id in (select id from ( SELECT id,office_code, is_important, RANK() OVER (ORDER BY id DESC) as sal_rank  FROM lettermaster  where is_important='1' and office_Code in (select office_code from offices where department_code='" & dept98 & "')  WHERE sal_rank <= 3)
    			    
    			    REGSQL = "select decode(filetype,null,'.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;.&nbsp;|&nbsp;<a href=""?op1=del'||'&'||'id='||ID||'"" onclick=""return window.confirm(''Are you sure to delete this Letter. This can not be reverted.'')"">Delete</a>','<a href=""../inc/getfile.aspx?id='||id||'&'||'doctype='||lettermaster.filetype||'&'||'file=filetracker.lettermaster-softcopy"" target=_blank>Download</a>&nbsp;|&nbsp;<a href=""?op1=del'||'&'||'id='||ID||'"" onclick=""return window.confirm(''Are you sure to delete this Letter. This can not be reverted.'')"">Delete</a>') as ""_"", id as ""Ref No"", '<a href=""frmlettertrack.aspx?office_code='||office_code||'&'||'diaryno='||diary_no||'"">'||letter_no||'</a>' as ""Letter No"", sender_date as SDate, sender as ""Letter From"",(select office_name from offices where office_code=other_details) as ""Letter To"", subject from lettermaster where id in (select id from ( SELECT id,office_code, is_important, RANK() OVER (ORDER BY id DESC) as sal_rank  FROM lettermaster where is_important='0' and office_Code ='" & office98 & "'    ) where sal_rank<=10) "
    			    'Response.Write(REGSQL)
    			    
    			    
    			    
    			    
    			    
    			    
    			    RStoTable(REGSQL, "LETTERS " & IIf(category <> "", " (CATEGORY: " & UCase(category) & ")", "") & ";impletters;impletters", "100%;400", 5, 15, -1, "10;8;8;10;10;10", "")
    
    %></div>
    			</td></tr> </table>
        </form>
    </body>
    </html>



    Monday, August 5, 2013 3:09 AM
  • User442781244 posted

    hi

    oned_gk

    when i am uploading no problem..

    but when downloading...i am not getting correct form. kindly see code.and suggest me web.config file has 1gb limit. now plz plz

    If FileId <> 0 Then
    rst.Close()
    rst.Open("select softcopy, filetype from filetracker.lettermaster where id=" & FileId, cnn, 1, 2)

    Dim flen As Integer
    flen = txsoftcopy.FileBytes.Length
    If flen < 20000000 Then
    rst(0).Value = txsoftcopy.FileBytes
    rst.Update()
    Else
    rst(1).Value = ""
    rst.Update()
    End If


    Monday, August 5, 2013 3:12 AM