assigning Temporary File Folder using MvcUploader vice web.config

Last post 01-06-2011, 7:42 PM by gustyn. 4 replies.
Sort Posts: Previous Next
  •  12-27-2010, 10:58 PM 65536

    assigning Temporary File Folder using MvcUploader vice web.config

    This is more of an academic interest at this point, but is there a way to use the TempDirectory property vice putting it in the web.config file?  I cannot seem to get that property to work.  The program creates a resource file called "processing..." for each file, but then the app craps out with saying it cannot find the generic temp folder or throwing some other error depending on what settings I have, most notably setting the property for using the system temp folder by default.  However, once i set this in the web.config file, it works like a charm.
    Filed under:
  •  12-31-2010, 9:23 PM 65569 in reply to 65536

    Re: assigning Temporary File Folder using MvcUploader vice web.config

    Hi gustyn,
     
    Try property "TempDirectory", like below
     
      <CuteWebUI:UploadAttachments runat="server" ID="UploadAttachments1" TempDirectory="~/photos">
                </CuteWebUI:UploadAttachments>
     
    Regards,
     
    Ken
  •  01-01-2011, 7:07 PM 65571 in reply to 65569

    Re: assigning Temporary File Folder using MvcUploader vice web.config

    I am using MVC so I do not use the ASP.NET webforms in my views.  I have used the TempDirectory="" in my controller with no effect.  Thanks though for your answer.
     
     
  •  01-01-2011, 11:40 PM 65572 in reply to 65571

    Re: assigning Temporary File Folder using MvcUploader vice web.config

    Hi gustyn,
     
    Try this way
     
    1. Open file UploadHandler.ashx
     
    2. Find section below
     
      public override void OnUploaderInit(MvcUploader uploader)
        {
          
        }
     
    3. Change to
     
      public override void OnUploaderInit(MvcUploader uploader)
        {
             //change photo to your folder name
            uploader.TempDirectory ="~/photo";
        }
     
    4. Open file "Controllers/SamplesController.cs"
     
    5.  Add the same section as step3 in the the method below
     
    using (CuteWebUI.MvcUploader uploader = new CuteWebUI.MvcUploader(System.Web.HttpContext.Current))
                {
                 }
     
    Like 
     
    using (CuteWebUI.MvcUploader uploader = new CuteWebUI.MvcUploader(System.Web.HttpContext.Current))
                {
             uploader.TempDirectory = "~/photo";
    }
     
    6. Build the project
     
    Regards,
     
    ken
  •  01-06-2011, 7:42 PM 65620 in reply to 65572

    Re: assigning Temporary File Folder using MvcUploader vice web.config

    yeah, I think that would work.  the ashx file is probably saving to the default location (the one set in web.config in my case currently) only setting it in the control means it is looking for it in one spot when it was originally saved in the default.
     
    Currently I am only using the ashx file as a skeleton to handle the initial upload because I reaally need the controller to control all the saving etc due authentication requirements.  I do not want to have to control authentication over two different technologies.
     
    if you have a way to bypass the ashx file altogether, now that would be awesome.
     
    Thanks
     
     
View as RSS news feed in XML