locked
upload large files + postback RRS feed

  • Question

  • User-1944399319 posted
    Hi, I've been reading the great thread on this forum (http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=55127&PageIndex=1) about uploading large files and I finally managed to get it working. But now I'm stuck to another problem: I'm using what they called the "dredman vars" to avoid redirecting the page after uploading is finished: ------------------- private byte[] PopulateRequestData(HttpWorkerRequest hwr, byte[] data) { BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic; Type type = hwr.GetType().BaseType; int i = (int)data.Length; type.GetField("_contentAvailLength", bindingFlags).SetValue(inWR, i); type.GetField("_contentTotalLength", bindingFlags).SetValue(inWR, i); type.GetField("_preloadedContent", bindingFlags).SetValue(inWR, inData); type.GetField("_preloadedContentRead", bindingFlags).SetValue(inWR, true); } ------------------- What I do, is that I overwrite the "_preloadedContent" field with the raw request data I parsed minus the file input field in the form. But when I do this, the posted page is not "postbacking", I mean when I display the value of Page.IstPostBack (after I hit submit), I get "False", and I can't get any field value entered by the user before the page is posted. I have a file input and a textfield (TextBox1) in my form. When I hit submit, I get postback = False TextBox1 = This is when I overwrite the _preloadedContent. When I comment this line: type.GetField("_contentAvailLength", bindingFlags).SetValue(inWR, i); type.GetField("_contentTotalLength", bindingFlags).SetValue(inWR, i); //type.GetField("_preloadedContent", bindingFlags).SetValue(inWR, inData); type.GetField("_preloadedContentRead", bindingFlags).SetValue(inWR, true); I get : postback = True TextBox1 = some entered text Why can't I get the value of the textfield when I alter the _preloadedContent field? Can somebody help me? Thanks & Regards, Hamza.
    Friday, June 4, 2004 5:19 AM

All replies

  • User-1944399319 posted
    OK I managed to fix that problem. It was an issue with the new inData variable which was not correct. Now, my problem is that the upload works great locally, but then when I put it in the hosting's server, it is unstable. When I upload a file of 2 megs, it works, but when I upload one of 5 meg, it uploads 70%, then stops, and I get "The page cannot be displayed". The 70% takes around 25 minutes to upload, and then it "crashes".. Do you have any clue why it stops after a certain time? Thanks in advance, Hamza.
    Sunday, June 20, 2004 6:21 AM
  • User1694595804 posted
    I have a solution as you need,but in chinese http://bestcomy.europe.webmatrixhosting.net
    Monday, June 21, 2004 7:10 AM
  • User-1944399319 posted
    Hello, Thanks for your reply. I already have my upload component done, it's just that it doesn't work on the host's server. One thing I've found is that my upload component works on IIS 5 but not on IIS 6 (the host is using IIS 6). Do you know what could be the error? Thanks in advance, Hamza.
    Tuesday, June 22, 2004 1:45 PM
  • User1754871805 posted
    hamza, In case you haven't already found it, the same thread has the answer of your question. Look for replies by Peekaboo. I had the same problem with IIS 6 and now the upload is running just fine. You just need to add another .BaseType to the value of the variable type. Sameh
    Wednesday, July 28, 2004 3:06 PM