|
Rank: Advanced Member Groups: Member
Joined: 6/5/2007 Posts: 76
|
I have a problem with uploader so I downloaded the latest build of the EO suite
Now I get an pop up about a httpmodule error, so I add the following to my config as the instructions said
<httpModules> <add name="EOWebRuntime" type="EO.Web.Runtime,EO.Web"/> </httpModules>
The error still doesn't go away and the file doesn't upload.
I add O.Web.Runtime.DebugLevel = 0 and the error goes away but the file doesn't upload.
So now I look in the example source code for help and that module entry isn't even in the sample webconfig file so what am I missing?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
The module only need to be in there if you have other modules/code that tries to fetch the form data before it reaches us. When that happens, because the data has already been fetched when it reaches us, our uploader can't function correctly. There is no such code in our sample project, that's why the sample project doesn't have it in the web.config.
Our module hooks up with Application_BeginRequest, which is the most earlies event ASP.NET offer. However, there can be other modules, or user code that also handles Application_BeginRequest and "rob" the data off us. So try check those and see if you can find any. You can try to start a new project and then find out the difference by comparing step by step.
Adding EO.Web.Runtime.DebugLevel = 0 merely silent the error message, it does not solve the real problem.
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
One more note, accessing session variables will fetch form data.
|
|
Rank: Advanced Member Groups: Member
Joined: 6/5/2007 Posts: 76
|
My code uploads a file then copies it from the temp to a different location and renames it.
I do this in the procedure:
Protected Sub AJAXUploader1_FileUploaded(ByVal sender As Object, ByVal e As System.EventArgs) Handles AJAXUploader1.FileUploaded . . . .
If the file size is < about 44kb if works. Larger file sizes only uploads 44mb then stops, corrupting the file.
I thought this latest version fixed this problem, but it doesn't. I have no other http modules in the webconfig, or added to the development machine
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Can you create a small reproducing sample project for us?
|
|
Rank: Advanced Member Groups: Member
Joined: 6/5/2007 Posts: 76
|
Web page and code behind page below:
page is uploadtest.aspx code is uploadtest.aspx.vb
It also has my own server sided extension checker.
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="uploadtest.aspx.vb" Inherits="uploadtest" %> <%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <eo:AJAXUploader ID="AJAXUploader1" runat="server" TempFileLocation="~/portal/reports/temp/" Width="250px" AllowedExtension=".doc"> </eo:AJAXUploader> </div> </form> </body> </html>
Imports System.IO
Partial Class uploadtest Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub AJAXUploader1_FileUploaded(ByVal sender As Object, ByVal e As System.EventArgs) Handles AJAXUploader1.FileUploaded
Dim tempFilename As String = "" Dim clientFilename As String = "" Dim file As EO.Web.AJAXPostedFile Dim allowedExtensions = "rpt,pdf,doc,rtf,txt,csv,xls" Dim extType As String = ""
' get the file names of the uploaded file For Each file In AJAXUploader1.PostedFiles tempFilename = file.TempFileName clientFilename = file.ClientFileName Next
' only do the next part if a file was uploaded to grab the file extension If tempFilename <> "" Then tempFilename = Mid(tempFilename, InStrRev(tempFilename, "\") + 1, tempFilename.Length() - InStrRev(tempFilename, "\")) clientFilename = Mid(clientFilename, InStrRev(clientFilename, "\") + 1, clientFilename.Length() - InStrRev(clientFilename, "\")) extType = common.getFileExtension(clientFilename)
' is this an allowed file If InStr(allowedExtensions, extType) > 0 Then
' copy the uploaded file from temp to new location and rename copyUploadedFile(tempFilename, clientFilename)
' now we insert the record into the database 'Dim reportAdapter As New reportsTableAdapters.tblReportsTableAdapter() 'reportAdapter.Insert(txtID.Text, txtTitle.Text, txtSummary.Text, txtDescription.Text, clientFilename, extType + ".gif", True)
Response.Redirect("addreportthankyou.aspx") End If End If End Sub
Protected Sub copyUploadedFile(ByVal tempFilename As String, ByVal clientFilename As String)
File.Copy(Server.MapPath("~/portal/reports/temp/") + tempFilename, Server.MapPath("~/portal/reports/files/") + clientFilename)
End Sub
End Class
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi Paul,
I don't think it has anything to do with the code you posted. It has to do with your project, or the "server extension" that you mentioned. I would need you to create a complete project that we can load and run at here to reproduce the problem.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 6/5/2007 Posts: 76
|
To update
If I create a new project and add the code to that, it works????
If I have it in my current project it doesnt work.
Question is now why it doesn't work in the existing project. The previous version worked OK for small files, but this version doesn't work at all in this project.
There's nothing special going on in this one? Do you have any idea as to what could be causing it
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Paul Creedy wrote:Question is now why it doesn't work in the existing project. Hi Paul, The answer is quite clear, as I have expected, that the problem roots in your project. That's why I want to you find out what's "special" about your project, and specifically, what triggered the problem. If we know what triggers it, then we may have a solution for you. As for small files or big files it doesn't matter. If it can not handle big files, then it's wrong; If it can not handle small files, then it's also wrong; It's absolutely wrong if it can not handle both; And they are the same problem. So no need to waste time pondering why it works with small files but not big files. We know exactly why. The same fire burns everything, we just don't know who starts the fire. Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 6/5/2007 Posts: 76
|
Think I've found it :-)
In my web config I had trace on to monitor the site
<trace enabled ="true" pageOutput ="false" requestLimit ="20" traceMode ="SortByTime " />
Removing this line allows the uploader to work. There must be a conflict somewhere?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi Paul,
Good job! Thanks for sharing. That's something we didn't know. We will look into it and see what we can find. In the mean time, I guess you already found yourself a workaround. :)
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 6/5/2007 Posts: 76
|
Would be handy if there was a permanent solution other than removing the trace as I often use it to try and find bottlenecks in the code.
At least its working now :-)
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Paul Creedy wrote:Would be handy if there was a permanent solution other than removing the trace as I often use it to try and find bottlenecks in the code.
At least its working now :-) Yes. We understand.
|
|