Hi ..dude? :-) Good point about the chunks problem! I've been through a couple of ways to solve the problem - most ended in ugly code. However, this solution might be of interest : I assume you've got a buffer holding a chunk of request data 1. Search buffer
for boundary 2. If boundary is not found: write buffer.length - boundary.length to file! This is the trick! Fill buffer. Goto step 1. 3. If boundary is found, only write to boundary...of course :-) It is short and simple to implement - only filling the buffer
is a bit cumbersome, since some data will still be left in the boundary between iterations. However, you can isolate this problem in a helper function. kind regards, Rasmus
HTTP Module -> Http Handler: Just want to tell you that the upload component can be written as a HTTP Handler instead of a HTTP Module! There is really no trick to it. Just copy/paste the code into a http handler instead. I've moved to a http handler to get
rid of the performance penalty that a http module gives. It is irritating to know that every page request has to go around a http module, even if 99 out of 100 request aren't file uploads. With http handlers we are back to more standard ways of doing things.
The upload can still be fully interceptet and uploaded in small chunks, even though we are now at a much lower level at the http pipeline. However, I still think we have to stay away from using session state. I think this will trigger the standard request
parsing...though someone might be able to work around this? Kind regards, Rasmus
Hi all. I'm back to my favourite thread. Well everything is working perfectly for me except for one item. The dredman variables. What am I missing in this thinking? 1. Someone submits a 500 meg file from a form page with one form field input. 2. I do some stuff
that tells me this person can't upload to the site. 3. Now what do I do? I don't want to sit through the 500mb - I just wanna get this guy out of my hair right now and redirect him to another page or the same page - I don't care. What I don't wanna do is give
him a nondescript error page like is happening now. So what exactly do I pass in as the inData variable to the dredman variables? Do I pass in the byte stream of a request I can hard code to a certain page etc. Any help would be appreciated. What would be
interesting would be the code for the smallest byte array you can pass in for a valid request. And why don't they showcase a solution on the home page of www.asp.net and help us instead of showcasing that webmatrix joke. -Goyaman
I have been wondering same thing...this thread has been going on for well over a year (I think), and although in other threads you occasionally see a post from someone from microsoft, are there any such posts here? It doesn't seem to be a completely off-the
wall propriatary thing, being able to handle file uploads in a user-friendly way... I have not worked recenlty on this problem, but believe I am close to solution now. I am still some distance from where you appear to be goyaman, but my C# is limited so am
working with VB :(
Hi Goyaman Nice to have you back :-) So what exactly do I pass in as the inData variable to the dredman variables? Do an upload of an empty file from a form without a viewstate (ie without a runat=server). Read the dredman vars (replace the SetValue
with a GetValue - the parameters are almost the same). Once you've got them, insert them to dismiss the upload. If you run into trouble with the dredman code, look for some info on asp.net Reflection on the net. I played around with it some time ago. I think
InData was just supposed to be "" - but I cannot quite remember. Anyway, using the above mentioned method you'll find out. kind regards, Rasmus
Gotta Ask! Has anyone done a version of this implemented as an HttpHandler that they're willing to shared a downloadable, working version of (or even post to GotDotNet). This is an issue which many ASP.NET developers don't know about, having a free version
of an upload / download component would be great.
Oh man I'm am so way ahead of you. Did this...no luckeroo. > Do an upload of an empty file from a form I get a blank form. Then I placed the exact output to the _preloadedContent. Then when a ridgy didge file comes through I set the dredman vars with the saved
byte array of the empty form - and update the size and stuff. No lucky luck. So what else do I have to do? Like all I wanna do is stop a request that's too big depending on the target url!!! and when I say stop I mean redirect it to another page cleanly. Obviously
anyone who got this working is not reading this thread anymore. -Goyaman
You are absolutely right. I haven't solved the problem the way you propose - I've tried - but: I don't think you can dismiss the upload simply by fixing the dredman vars, since I believe it is partially related to the client browser expecting the server to
accept its request! Try to do an upload to a standard html page and you'll get the same error. Obviously the client browser is involved. However, it really isn't a problem to work around this. Do your upload in a hidden frame (just set a target for the form).
Keep another frame for informing the user of progress. When an oversize upload is detected (easy - we are in control the SECOND the upload begins using the solutions discussed above) , set some text to be displayed in the progress frame - and let the hidden
page fail! Why not? The users are looking at your progress frame anyway, the server is not wasting resources on it, so who should this irritate? Kind regards, Rasmus
>I don't think you can dismiss the upload simply by fixing the dredman vars, since I believe Okay so in addition or instead of the dredman vars (which are quickly becoming useless) how do I dismiss the upload? So for that matter in what application are the
dredman variables useful in any way? And how have people used them. ( the question is not directed at you rasmus, just to somebody who has solved this - if indeed anybody has who is not working for ABCUpload or whatever ) The workaround is fine as a workaround
but not a solution. SO HAS ANYBODY AT ALL EVER DISMISSED A DOWNLOAD NICELY WITHOUT A SERVER ERROR? If nobody has I shall stop my work right now and move on to something else. Just all this dredman variable talk was interesting but entirely useless to any application
in regard to the component. -Goyaman
ups101
Member
205 Points
41 Posts
Re: HttpHandler or HttpModule for file upload, large files, progress indicator?
Jul 15, 2003 09:29 PM|LINK
ups101
Member
205 Points
41 Posts
Re: HttpHandler or HttpModule for file upload, large files, progress indicator?
Jul 15, 2003 09:43 PM|LINK
goyaman
Member
35 Points
7 Posts
Re: HttpHandler or HttpModule for file upload, large files, progress indicator?
Jul 15, 2003 10:47 PM|LINK
sjstokes
Member
485 Points
97 Posts
Re: HttpHandler or HttpModule for file upload, large files, progress indicator?
Jul 15, 2003 11:03 PM|LINK
ups101
Member
205 Points
41 Posts
Re: HttpHandler or HttpModule for file upload, large files, progress indicator?
Jul 16, 2003 12:17 AM|LINK
ups101
Member
205 Points
41 Posts
Re: HttpHandler or HttpModule for file upload, large files, progress indicator?
Jul 16, 2003 12:29 AM|LINK
"); ctx.Response.Write("ContentAvailLength : " + type.GetField("_contentAvailLength", bindingFlags).GetValue(hwr).ToString() + "
"); ctx.Response.Write("ContentTotalLength : " + type.GetField("_contentTotalLength", bindingFlags).GetValue(hwr).ToString() + "
"); ctx.Response.Write("PreloadedContentRead : " + type.GetField("_preloadedContentRead", bindingFlags).GetValue(hwr).ToString() + "
"); ctx.Response.Write("ContentType : " + type.GetField("_contentType", bindingFlags).GetValue(hwr).ToString() + "
"); ctx.Response.Write("ContentLengthSent : " + type.GetField("_contentLengthSent", bindingFlags).GetValue(hwr).ToString() + "
"); ctx.Response.Write("PreloadedContent :
" + DecodeToString((byte[])type.GetField("_preloadedContent", bindingFlags).GetValue(hwr))); }
Scott Gallow...
Participant
1510 Points
302 Posts
Re: HttpHandler or HttpModule for file upload, large files, progress indicator?
Jul 16, 2003 03:41 PM|LINK
goyaman
Member
35 Points
7 Posts
Re: HttpHandler or HttpModule for file upload, large files, progress indicator?
Jul 16, 2003 04:20 PM|LINK
ups101
Member
205 Points
41 Posts
Re: HttpHandler or HttpModule for file upload, large files, progress indicator?
Jul 16, 2003 06:43 PM|LINK
goyaman
Member
35 Points
7 Posts
Re: HttpHandler or HttpModule for file upload, large files, progress indicator?
Jul 16, 2003 07:27 PM|LINK