do not use temp folder at all

Last post 10-07-2010, 1:04 PM by mulmad. 8 replies.
Sort Posts: Previous Next
  •  11-17-2009, 8:06 AM 57209

    do not use temp folder at all

    Good Day!
    I`m developing  application,where users will upload .xls files, which will be parsed on service end into dataset object and returned as datasource to gridview. I am using memorystream to get byte[ ] of uploaded .xls file and I do not need to store any files physically on hard disk. Is it possible? No temp files, no temp directory.
  •  11-17-2009, 10:16 AM 57215 in reply to 57209

    Re: do not use temp folder at all

    AMIL,
     
    All temp files will be deleted automatically by Ajax Uploader. All files will be uploaded into temp directory first instead of loading the files into memory.
     
    In asp.net 1.1, the built-in upload function of asp.net framework loads the uploaded files into memory.
     
    In asp.net 2.0, the built-in upload function of asp.net framework already changed this logic and loads the uploaded files into temp directoty as well.
     
    So we think it's the good solution to handle the uploading.

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  11-17-2009, 12:29 PM 57218 in reply to 57215

    Re: do not use temp folder at all

    thanks for reply, Adam. Than it can`t be somehow workarounded? To get rid of temp folder and temp files? If nothing can be done, then how I can set time of tempfolder cleanup to minimum?
  •  11-17-2009, 9:02 PM 57229 in reply to 57209

    Re: do not use temp folder at all

    Hi,
     
    You can specify the uploader provider to upload the temp file to database.
     
    Here is the configuration and source code. You can modify it or create your own provider :
     
    Web.config :
     
    <add key="CuteWebUI.AjaxUploader.UseAspNetStream" value="True"/>
    <add key="CuteWebUI.AjaxUploader.Provider" value="UploaderDatabaseProvider.UploaderSqlServerProvider,App_Code"/>
    <add key="UploaderDatabase" value="server=(local);database=UploaderSamples;uid=test;pwd=test"/>
     
    Sql Schema:

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AjaxUploaderTempFiles]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    drop table [dbo].[AjaxUploaderTempFiles]
    GO

    CREATE TABLE [dbo].[AjaxUploaderTempFiles] (
     [FileGuid] [uniqueidentifier] NOT NULL ,
     [FileTime] [datetime] NOT NULL ,
     [FileName] [nvarchar] (255)
     [FileSize] [int] NOT NULL ,
     [FileData] [image] NOT NULL ,
     [IsPersist] [bit] NOT NULL
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO

    ALTER TABLE [dbo].[AjaxUploaderTempFiles] WITH NOCHECK ADD
     CONSTRAINT [PK_AjaxUploaderTempFiles] PRIMARY KEY  CLUSTERED
     (
      [FileGuid]
     )  ON [PRIMARY]
    GO
     
     
    Provider Code:
     
     
     
     
    Regards,
    Terry
     
  •  11-19-2009, 4:46 AM 57282 in reply to 57229

    Re: do not use temp folder at all

    cutechat, thanks for your reply! But I really don`t want to save these files on hard disk neither in database. How about Memory Mapped Files? Maybe I can save these temp files in memory, using MemoryMappedFile  or Cache? Maybe have that kind of experience? 
  •  11-24-2009, 10:01 AM 57386 in reply to 57282

    Re: do not use temp folder at all

    Hi,
     
    In that case , you need write your custom provider.
     
    It's not recommanded because your server may get attack and the memory will be filled fully.
     
    Regards,
    Terry
  •  10-07-2010, 7:45 AM 64347 in reply to 57215

    Re: do not use temp folder at all

    When are files in the temp directory deleted?
     
    I thinking: if users upload files to temp dir and are cut of.
  •  10-07-2010, 9:11 AM 64349 in reply to 64347

    Re: do not use temp folder at all

    Dear mulmad,
     
    You do not need take care the temp files.
    Temp file means the uploaded data & info of a file. It's owned and maintained by Uploader instead of  your application. 
    What you need to do is , in some event handler , copy or move the file to your destination folder.
    Temporary files will be deleted after 5 hours.
     
    Thank you for asking
  •  10-07-2010, 1:04 PM 64353 in reply to 64349

    Re: do not use temp folder at all

    thanks for quick reply
View as RSS news feed in XML