Welcome Guest Search | Active Topics | Sign In | Register

Frustrated with uploader Options
Paul Creedy
Posted: Thursday, September 20, 2007 6:38:57 AM
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?

eo_support
Posted: Thursday, September 20, 2007 6:47:00 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,089
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
eo_support
Posted: Thursday, September 20, 2007 6:48:11 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,089
One more note, accessing session variables will fetch form data.
Paul Creedy
Posted: Thursday, September 20, 2007 6:49:55 AM
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

eo_support
Posted: Thursday, September 20, 2007 6:53:42 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,089
Can you create a small reproducing sample project for us?
Paul Creedy
Posted: Thursday, September 20, 2007 7:10:57 AM
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>
&nbsp;</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


eo_support
Posted: Thursday, September 20, 2007 7:38:38 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,089
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
Paul Creedy
Posted: Thursday, September 20, 2007 7:54:31 AM
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
eo_support
Posted: Thursday, September 20, 2007 8:03:04 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,089
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
Paul Creedy
Posted: Thursday, September 20, 2007 8:28:36 AM
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?
eo_support
Posted: Thursday, September 20, 2007 8:33:25 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,089
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
Paul Creedy
Posted: Thursday, September 20, 2007 8:37:15 AM
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 :-)
eo_support
Posted: Thursday, September 20, 2007 8:39:38 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,089
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.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.