【问题标题】:I want to redirect the page after photo upload我想在照片上传后重定向页面
【发布时间】:2013-02-12 11:40:38
【问题描述】:

我正在使用以下链接http://blueimp.github.com/jQuery-File-Upload/ 中的照片上传 但我想在上传完成后重定向页面。请帮帮我。

【问题讨论】:

    标签: php javascript redirect photo-upload


    【解决方案1】:

    这里:

    <?php
    /* do something with the upload code..... */
    /* Redirect browser */
    header("Location: http://theos.in/");
    /* Make sure that code below does not get executed when we redirect. */
    exit;
    ?>
    

    【讨论】:

      【解决方案2】:
      var totalUploadCount = $('#fileUpload').length;
      var completedCount = 0;
      
      
      $('#fileupload').fileupload({
              dataType: 'json',
              done: function (e, data) {
                      if(completedCount++ == totalUploadCount)
                          window.location = "http://www.yoururl.com";
                  });
              }
          });
      

      【讨论】:

      • 我在 main.js 中添加了这个,但只上传单张照片而不是多张。在哪里添加此代码
      • 使用此代码没有显示进度,也没有上传照片。
      • 如果我删除 '});'然后显示进度,但上传单张照片
      • 这个代码块只是为了了解它是如何工作的而不是复制粘贴。我没有你的插件,我没有你的代码和环境。这个想法很清楚,我想这就足够了..
      • 请在上面的链接中下载并帮助我
      【解决方案3】:

      上传成功后使用这个

      header ("location: YOUR-PAGE.php");
      return;
      

      【讨论】:

        【解决方案4】:

        在您的上传完成回调 (fileuploaddone) 中使用 window.location.href = 'new url'。阅读API 了解更多关于回调的信息。

        【讨论】:

        • 如何添加请帮帮我,在哪里添加给出完整的代码,重定向应该在所有多张照片上传后完成。我在一次上传后使用重定向的一些代码。当我使用你的代码时,没有进度显示,也没有完成上传。
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-10-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多