Error uploading files via drag and drop

Topics: Developer Forum
Apr 9, 2012 at 3:25 PM

I am using N2 2.2.1 for a site which requires hundreds of file uploads. When I attempt to drag and drop a few files onto the area designated for file drag and drop not all the files are uploaded. Furthermore, the files which are uploaded are not consecutive. For example, if I drag and drop 10 files, maybe files 1, 2, 3, 5, 7, and 9 are uploaded while files 4, 6, 8 and 10 are not. When this occurs there is no indication which files didn't upload. 

Also, I have health monitoring on, and the following error is occasionally generated when not all the files are uploaded.

Exception information:
   Exception type: System.ArgumentException
   Exception message: Invalid value for 'encryptedTicket' parameter.

Stack trace:    at System.Web.Security.FormsAuthentication.Decrypt(String encryptedTicket)
  at N2.Management.Files.FileSystem.UploadFile.ValidateTicket(String encryptedTicket)
  at N2.Management.Files.FileSystem.UploadFile.ProcessRequest(HttpContext context)
  at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
  at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Thanks

Daniel

Coordinator
Apr 11, 2012 at 9:50 PM

Could you do some tracing using fiddler or firebug?

Developer
Apr 11, 2012 at 10:47 PM

I do know that if I try to upload a file that is too big via the control, the asp.net exception is ignored by the client-side script and it fails silently.

From: libardo [email removed]
Sent: Wednesday, April 11, 2012 2:50 PM
To: Ben Herila
Subject: Re: Error uploading files via drag and drop [n2cms:351680]

From: libardo

Could you do some tracing using fiddler or firebug?

Apr 12, 2012 at 12:27 PM

If the files that fail are bigger than 4M you need to increase maxRequestLength. Default is 4096 Kb

  <system.web>
    <httpRuntime maxRequestLength="4096"/>

Coordinator
Apr 17, 2012 at 10:11 PM

Hi I found a bug when uploading many files. This is the fix:

https://github.com/n2cms/n2cms/commit/28701c9fac71134c44523f47ac702abe5e04c10c

Apr 23, 2012 at 3:12 PM

Thanks for posting the fix. Currently the bug exists in the latest release of N2, version 2.2.1, which we are using for our website. I would like to be able to apply the fix to the release version of N2, rather than upgrading to the latest development build. How could I simply apply the fix to the release version of N2?

Thanks

Daniel

Coordinator
Apr 23, 2012 at 6:22 PM

The problem is that the ui is refreshed before the upload is complete. You could try removing  "window.location = window.location;" and adding a "refresh" button instead.

Apr 27, 2012 at 7:56 PM

Cool. Got it. Here are the steps to fix the issue.

  1. I Extracted the N2.zip file
  2. Opened the N2\Files\FileSystem\FileUpload.ascx file
  3. Modified line 5 to add a Refresh button.
    <p><strong><%= GetLocalResourceString("SelectFiles", "Select files to upload") %> - or - <a style="color:Blue;" href="">Refresh</a></strong></p>
  4. Removed line 29 to prevent refreshing before the uploads are complete.
    window.location = window.location;

That should do it.