1

我正在使用“plupload”上传文件,然后重定向到确认页面。我想做的是将文件名添加到 url 字符串

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=!!!!!!!!!';
    };
})

我真的很感激这方面的一些帮助,坦率地说,这让我分心!

4

2 回答 2

5

这应该可以解决问题:

Uploader.bind('FileUploaded', function(Up, File, Response) {
  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

于 2011-08-05T12:24:02.917 回答
0

I am not much sure about PHP but plupload use file as form variable for file you are trying to upload. If you just want to pass file name in url try different name may be filename instead of file.

于 2011-08-05T12:27:30.477 回答