views:

1347

answers:

3

Hi

I've just downloaded the new AjaxControlToolkit from codeplex to give the much anticipated AsyncFileUpload control a go, but unfortunately it has fallen at the first hurdle...

I have put it on a fairly simple page called uploadFile.aspx which takes a url argument:

uploadFile.aspx?myDbId=1

In the page load, it's doing stuff with Request["myDbId"].

When selecting a file using the new control, it posts it back straight away, but it hits a 500 error with the Request["myDbId"] line because it has stripped ALL url arguments and replaced them for it's own:

uploadFile.aspx?AsyncFileUploadID=ctl00_BodyPlaceHolder_ctl00&rnd=08382490910589695

This to me is a massive problem, and one I haven't been able to get around. Any solutions?

A: 

Here's an alternate solution if that one doesn't work out. This solution has been around for a year or two, and it is his second version. It includes a progress bar that doesn't require a flash dependency, and can handle very large files without problems.

ASP.Net File Upload Module v2
http://darrenjohnstone.net/aspnet-file-uploaddownload-module-v2-documentation/

Robert Harvey
I don't think this is quite what I'm after - it seems to involve a lot of setup, and there's no access to the FileSystem or SQL Server so I'd have to write something to process the upload. I was hoping for something more similar to the standard control - which is why we were looking at the Ajax Toolkit one that's just been produced, but it's broooked
Paul
Setup is required because an Http handler is installed; this is what makes it possible to handle large file sizes without running out of memory on the IIS server. Not sure what you mean by access to the file system. There is a module included that allows direct upload to SQL Server.
Robert Harvey
Sorry, that's what I mean (I've just accidentally upvoted your comment, hehe - mad moment, I thought it was a house!), I can't use the module for directly uploading to SQL Server - or the module for uploading directly to file system.
Paul
How can you upload the file if you don't have access to the file system? Where is it going to go?
Robert Harvey
Cos it gets uploaded, there's a load of processing that happens on it, and then it's stored in an object which eventually gets stored in the database. It never gets stored on disk (well - other than it being in a temporary file I imagine)
Paul
Having just spent hours seeing if this one would work, I have just discovered that it's not actually an ajax control, it relies on a full postback! Gah, it can't be compared to SWFUpload if it doesn't do the uploads asynchronously
Paul
Sorry about that. I got to thinking about it, did a little Googling, and found this: http://www.codeproject.com/KB/XML/MTOMWebServices.aspx. Hope it helps. Ultimately I think some solution in WCF is probably the way to go.
Robert Harvey
I used a similar approach to this one - but had to roll my own to make it work
Paul
A: 

Can you use a Session variable to manage myDbId?

Robert Harvey
Sadly no, that would involve a fairly big refactor to what's there at the moment
Paul
A: 

You could encode the id in the filename, so just append "--" + myDbId to the filename. The fact that it comes after the extension could make it easier to know that this was added.

James Black