SlickUpload
Welcome Guest Search | Active Topics | Log In | Register

File upload not working when file filter is used Options
mjameel
#1 Posted : Monday, February 25, 2008 4:42:48 PM
Rank: Newbie

Groups: Registered

Joined: 2/25/2008
Posts: 2

I am having difficulty uploading a file after I started using the FileName Filter tag. If I comment out the uploadParser tag, the upload works fine. Otherwise, the progress bar stays at zero position anddoes not move. I have tried both BeginRequest and PreRequestHandlerExecute and both are failing.

I have configured the web.config as below

<uploadParser attachEvent="BeginRequest" requestFilter="FDAWeb.FileNameFilter, FDAWeb" />
<uploadStreamProvider provider="File" location="~/Files/" existingAction="Overwrite" fileNameMethod="Custom" fileNameGenerator="FDAWeb.FileNameGenerator, FDAWeb" />
<statusManager manager="SqlClient" connectionString="server=servername;uid=username;pwd=password;database=database"
table="Table" keyField="SESSN_GUID" statusField="SESSN_STAT_TXT" lastUpdatedField="SESSN_LAST_MODD_DTTM" updateInterval="1" />

The overriding method - ShouldHandleRequest method is working fine and returning true or false based on the file extension.

The server is win2k sp4, and is configured to use .Net framework version 1.1

Can you please help me fix this issue? Is this a known bug?

Thanks,
Jameel.

ChrisHynes
#2 Posted : Tuesday, February 26, 2008 1:04:02 PM
Rank: Administration


Groups:

Joined: 7/7/2005
Posts: 1,586
Location: Scottsdale, AZ

That should work with no problem. Can you send me a copy of the request filter class you are using so I can take a look at it? chrish@krystalware.com...

 

mjameel
#3 Posted : Tuesday, February 26, 2008 1:24:34 PM
Rank: Newbie

Groups: Registered

Joined: 2/25/2008
Posts: 2
Here is the code to implement filters.
 
I want a few file extensions to be handled by slick upload and others to be handled by asp.net in its own request.files() way.
I check the return codes and ShouldHandleRequest returns the correct boolean value
=====================================================================
Imports System
Imports System.IO
Imports Krystalware.SlickUpload
Public Class FileNameFilter
    Implements IUploadRequestFilter
Public Function ShouldHandleRequest(ByVal request As System.Web.HttpRequest) As Boolean Implements IUploadRequestFilter.ShouldHandleRequest
Dim AryExtensions As Array
Dim strExtn As String
Try
ShouldHandleRequest = False
AryExtensions = ".zip|.rar".Split("|")
For Each strExtn In AryExtensions
If HttpContext.Current.Request.Files(0).FileName.EndsWith(strExtn) Then
    Return True
    End If
    Next
Catch ex As Exception
    Throw ex
End Try
End Function
End Class
=====================================================================
ChrisHynes
#4 Posted : Wednesday, February 27, 2008 1:17:59 PM
Rank: Administration


Groups:

Joined: 7/7/2005
Posts: 1,586
Location: Scottsdale, AZ
Responded via email...
Users browsing this topic
Guest
Forum Jump  
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.