如何获得Plupload文件名? [英] How to get a Plupload filename?

查看:159
本文介绍了如何获得Plupload文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用plupload来上传文件,然后重定向到确认页面。
我想要做的就是将文件名添加到url字符串中。
$ b $ pre $ EG $(www.mysite / thanks。 php?file = file.jpg)

对于我这个级别的人来说,plupload的文档稀疏和我一直无法确定哪个变量/对象携带的文件名。

这里是我想要的代码

  Uploader.bind('FileUploaded',function(Up,File,Response){
if((Uploader.total.uploaded + 1)== Uploader .files.length){

// var myfilename = !!!!!!!!!!!!!

window.location ='uploaded.php?file = !!!!!!!!!';
};
})



我真的很感谢这方面的一些帮助,坦率地说,这让我分心了! 解决方案

  Uploader.bind('FileUploaded',function(Up,File,Respon se){
if((Uploader.total.uploaded + 1)== Uploader.files.length){
window.location ='uploaded.php?file ='+ encodeURIComponent(File.name) ;
};
})

您也可以查看其他选项的文档:http://www.plupload.com/plupload/docs/api/index.html#class_plupload.File .html


I am using "plupload" to upload files then redirect to an acknowledgement page. What I would like to do is add the filename to the url string

EG(www.mysite/thanks.php?file=file.jpg)

For someone at my level the documentation for plupload comes across as somewhat sparse and I have been unable to identify which variable/object carries the file name.

Here's where I would like to put the code

Uploader.bind('FileUploaded', function(Up, File, Response) {
  if( (Uploader.total.uploaded + 1) == Uploader.files.length) {

    // var myfilename = !!!!!!!!!!!!!           

    window.location = 'uploaded.php?file=!!!!!!!!!';
    };
})

I would really appreciate some assistance with this, frankly it's driving me to distraction!

解决方案

This should do the trick:

Uploader.bind('FileUploaded', function(Up, File, Response) {
  if( (Uploader.total.uploaded + 1) == Uploader.files.length) {
    window.location = 'uploaded.php?file=' + encodeURIComponent(File.name);
  };
})

You can also check the documentation for additional options : http://www.plupload.com/plupload/docs/api/index.html#class_plupload.File.html

这篇关于如何获得Plupload文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆