Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

After uploading...?
  • Hello, I hope someone can help.

    The Uploadify tool is great and it works fine for me however having uploaded a document I'd like to automatically take the user to another page.

    I'm using straightforward, non-fiddled with code but with aspx rather than php as the save mechanism, my documents upload beautifully and save into my database correctly but the user is left looking at the upload screen with the progress bar at 100%. Clicking "Cancel" removes the progress bar and I can obviously add a link or button to allow for going to the next page but I'd like to do it automatically.

    The demos final example shows the progress bar disappearing after upload but I couldn't see how to do that and even if that did happen I'd still like to move the user.

    Should I be using OnComplete? What do I need to tell it to do? I'm a newcomer to jquery and not great with javascript so I'm keen to get a good solution.

    Thanks in advance. :-)
  • Yes, you will need to use onComplete or onAllComplete. Then you will need to call some regular javascript to redirect to another page. A code snippet is below.


    window.location = \"http://www.mysite.com/someotherpage.html/\"
  • Thanks I thought that might be the case however I have no idea what the syntax would be for the oncomplete?

    Apologies for such a newbie question!
  • SarahD said:
    Thanks I thought that might be the case however I have no idea what the syntax would be for the oncomplete?

    Apologies for such a newbie question!


    I'm not sure why your progress bar doesn't disappear after the upload. Can you post some of your code?
  • This is my code.

    <head runat=\"server\">
    <link rel=\"stylesheet\" type=\"text/css\" href=\"CSS/Style.css\" />
    <link rel=\"stylesheet\" type=\"text/css\" href=\"CSS/Uploadify.css\" />

    <script type=\"text/javascript\" src=\"Javascript/jquery-1.3.2.js\"></script>
    <script type=\"text/javascript\" src=\"Javascript/jquery.uploadify.js\"></script>

    <script type=\"text/javascript\">
    $(document).ready(function() {
    $('#fileInput').fileUpload({
    'uploader': 'uploader.swf',
    'script': 'upload.ashx',
    'auto': true,
    'cancelImg': '\Images\cancel.png',
    'displayData': 'percentage',
    'buttonText': 'Choose File',
    'wmode': 'transparent'
    });
    });
    </script>

    <title>Document Management Add Document</title>
    </head>


    This is where my fileuploader is:
            <div class=\"greyBlock\">
    <div class=\"tr\">
    <asp:Label ID=\"attachFile\" Text=\"Attach a file\" CssClass=\"heading2\" runat=\"server\"></asp:Label>
    <asp:Label ID=\"fileSize\" Text=\"(Each file should be under 10MB)\" runat=\"server\"></asp:Label>
    </div>
    <div class=\"tr\">
    <input type=\"file\" id=\"fileInput\" name=\"fileInput\" runat=\"server\"/>
    </div>
    </div>


    My Css is very basic using CSS 2.0 tables etc.
  • Here is a mod that adds a simple onComplete.
    You didn't mention whether your asp upload code returns a response or not. It may need to even it if is just "1" (I'm not an asp programmer).

    [code=php]
        
    <</span>script type="text/javascript">
            $(document).ready(function() {
                var redirectURL = 'http://www.mysite.com/someotherpage.html';  // !!! CHANGE THIS TO YOUR URL !!! 
                $('#fileInput').fileUpload({
                    'uploader': 'uploader.swf',
                    'script': 'upload.ashx',
                    'auto': true,
                    'cancelImg': '\Images\cancel.png',
                    'displayData': 'percentage',
                    'buttonText': 'Choose File',
                    'wmode': 'transparent',
                    'onComplete': function(e, q, f, r, d) {
                        window.location = redirectURL;
                    }
                });
            });
        
    [/code]
  • My code now looks like this but it doesn't do anything more than it did before and certainly doesn't got to Google.

        <script type=\"text/javascript\">
    $(document).ready(function() {
    var redirectURL = 'http://www.google.co.uk';
    $('#fileInput').fileUpload({
    'uploader': 'uploader.swf',
    'script': 'upload.ashx',
    'auto': true,
    'cancelImg': '\Images\cancel.png',
    'displayData': 'percentage',
    'buttonText': 'Choose File',
    'wmode': 'transparent',
    'onComplete': function(e, q, f, r, d) {
    window.location = redirectURL;
    }
    });
    });
    </script>
  • bdp said:
    [quote="SarahD"]Thanks I thought that might be the case however I have no idea what the syntax would be for the oncomplete?

    Apologies for such a newbie question!


    I'm not sure why your progress bar doesn't disappear after the upload. Can you post some of your code?[/quote]

    I have a similar problem, Uploadify stay at 100% but do not disapear(even that my file upload correctly to the server) and that cause me that my 'onComplete' don't execute either.
    I realise that I miss of doing a forward of my requestDispatcher

    this.getServletContext().getRequestDispatcher(\"/index.jsp\").forward(request, response);

    *Sorry, I'm doing it in Java, don't know how is in asp, but the idea is the same ^^

    After that, Uploadify progrssbar dissapear and my 'onComplete' execute fine :)

    Hope it helps,

    Nicte
  • Hello,

    This may well help but where do I put this line of code?

    Sarah.
  • Hello,

    first of all, this is Java, don't know how is it exactly in asp(maybe someone else in the forum could tell it better than me)

    This you should put it when you finish uploading your file. In my case I create a method that upload files ("procesaFicheros(request)") and after it finish is where this line goes.

    if (ServletFileUpload.isMultipartContent(request)) {
    procesaFicheros(request);
    this.getServletContext().getRequestDispatcher(\"/index.jsp\").forward(request, response);
    }


    Nicte
  • Does anyone have an asp version?

    Something I could add at the bottom of my upload.ashx perhaps?
  • SarahD said:
    Does anyone have an asp version?

    Something I could add at the bottom of my upload.ashx perhaps?


    The PHP examples which use upload.php don't do anything special. The part of the code that receives the upload as a temporary file and moves/renames it to the desired location is a basic PHP file upload implementation. I would suggest you first create a simple vanilla html asp upload test page that does not use Uploadify. Once that is working you should be able to adapt that code for Uploadify.

    Also have a look at the Showcase section of this forum. Someone may have posted some asp specific examples. A lot of my (unanswered) questions have been resolved by posts there.