Print This Post

ASP.Net File Upload/Download Module v2.0.1

A minor update to the file upload module (v2.0.1) has been placed in the downloads area of the site. The following changes are included:

  • BUG FIX: the file name was not always displayed in the progress bar when multiple IFileProcessor implementations were used on the same page.
  • FEATURE: the attribute ajaxcall is added to upload buttons and set to none. This allows the control to work correctly with majic ajax- thanks Franklin.

The update should be a straight replacement. No public interfaces have changed. Setup kits and source have been provided in downloads.

There Are 14 Responses So Far. »

  1. Hi Darren

    Congratulations for such a great job!

    I have a little problem (I hope XD), how can I use two DJFileUploads at the same time? IE is hanging no matter what I try…
    BTW, I have them inside ifames.

    Thanks

  2. Hi Juan,

    As far as I know from testing there is no problem with having multiple file upload controls on a page. In fact, it is designed to support this. See http://demo.darrenjohnstone.net/fileupload.

    However, I have not tried it in an IFrame. The upload controls are not designed to be hosted in IFrames. There should be one instance of the DJUploadController to support all upload controls on the page.

    The DJUploadController also injects a hidden IFrame into the page to support the progress bar when javascript is disabled or the browser is Opera. Possibly this is the issue.

    Perhaps you could give me a little more detail on what you are trying to achieve and I’ll try to help you.

    Cheers,
    Darren

  3. Darren,

    I love this control. From what I can tell this is more than what I wanted, and makes my life much easier.

    I am having one problem though. I am trying to make this a usercontrol for my website. I get everything to work except saving the file. It just doesn’t do it. No errors nothing.

    Do you know why this would happen?

    BTW I am using a VB environment referencing your DLL, and converted the code from the example app to VB.

    Thanks for the help,

    Alex

  4. Hi Darren

    Thank you very much for your time.

    What I am trying to do is create an user control to support file uploads through all my app.

    I have the mentioned user control with some properties and code and an iframe pointing to a page with a DJUploadFile and a DJUploadController.

    I pass several properties through the QueryString, like allowed extensions and some others and put them in place in the Page Load.

    The problem comes when I have two or more of my user control in a page. When I try to upload more than one file, the IE freezes.

    Again, thank you very much.

  5. Alex,

    What file processor are you using? By default a dummy processor is used which ignores the files. To store them you need to use either the file system processor or sql processor and configure them correctly. Have you done this?

    Cheers,
    Darren

  6. Juan,

    I think your problem is related to the iframes. Using the control like this will result in iframes within iframes with ajax callbacks happening in each one. This is probably the reason why IE freezes.

    You can use the PreviousFields collection which is passed to the StartNewFile method of your file processor. This will give you access to other fields on the form so that you don’t have to use the query string. In this way you perhaps wouldn’t need to host the upload controls in an IFrame?

    Hope this helps.

    Cheers,
    Darren

  7. Hi Darren!

    I found out that the line
    “_status.UpdateBytes(data.Length, fs.Processor.GetFileName(), fs.Processor.GetIdentifier());”
    was causing my error, because I was using the same large file in both file uploads to do my tests.

    The problem is that it uses the file name to index the petition, so when it has two uploads of the same name falls in an infinite loop.

    Now I have it working, except the final postback I am doing in my user control is ruining the other concurrent uploads, but I more or less know how to solve it.

    Thank you!

  8. Darren,

    I’m using the processor declared with these lines:

    Dim fsd As New FieldTestProcessor()
    fsd.OutputPath = Server.MapPath(”~/uploads”)
    DJFileUpload1.FileProcessor = fsd

    Is there more that I need to do?

    I have checked just about everything from your example App and mine, and I can’t see what’s so different.

    Thanks for the help and time,
    Alex

  9. Hi Alex,

    It’s difficult to say without seeing your code. Would you be able to make a sample app and send it to me? I’ll take a look at it then.

    Cheers,
    Darren

  10. Hi Darren,

    First off thanks for the update to v2.01, great piece of work you have here!

    I have everything working well on an internal site I am tinkering with, having only one odd issue. I have the FileUpload in a panel within a form, which has a few server-side buttons. Whenever a server side button is clicked the FileUpload greys out the screen and I can see the download progress box roll down from the top of the screen.

    The postback occurs and whatever the button code does is complete and the screen goes back to normal. Is this expected behavior with post-backs on server controls or did I screw up my setup somewhere?

    Thanks for your help,
    Mike

  11. Hi Mike,

    I’ve uploaded version 2.0.3 of the upload module. This checks that there is at least one file upload present before displaying the progress bar- so this should solve your problem.

    Hope this helps.

    Cheers,
    Darren

  12. Thanks Darren! I’ve put in v2.03 and it the progress bar no longer appears, but the screen still “greys-out”… It’s not an issue for me however, I actually like that behaviour as it shows the client that something is “happening” during the post-back as a sort of please-wait type scenario.

    Any tips on a light method for implementing this site-wide on a project I am working on? I could just link your module in on the master page but I figured that would be like killing a fly with a sledge-hammer… Does the job, but probably not the most appropriate approach.

    Thanks!
    Mike

  13. Hi Mike,

    I’d probably have a site wide master page for design etc. and then create another master page which inherits it for upload pages. On the inherited page I’d put the DJUploadController and possibly provide a placeholder for upload controls.

    Cheers,
    Darren

  14. Hi Darren,

    I’m using your control on a page but in IE7 (works fine in Firefox/etc) when the file upload is complete I cannot type anything into any text boxes on that page (before the upload I could).
    Any ideas?

    Cheers,

    Jon

Post a Response