动态改变上传路径

动态改变上传路径

本文介绍了jQuery的文件上传插件:动态改变上传路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用blueimp jQuery的文件上传插件项目我目前工作的。它适合我的需要完美的,有一个问题:我需要能够改变上传的路径,基于包含插件页面上的GET变量。基本上,我使用它作为一个图片管理器对车辆的集合,我希望它连接到一个单独的文件夹,每个车辆。

I'm trying to use the blueimp Jquery File Upload plugin for the project I'm currently working on. It suits my needs perfectly, with one problem: I need to be able to change the path of the uploads, based on a GET variable on the page that contains the plugin. Basically, I'm using it as an image manager for a collection of vehicles, and I want it to connect to a separate folder for each vehicle.

我一直在寻找通过文档和谷歌搜索,我发现更改默认目录的方式(通过修改upload.class.php),但因为我需要这是动态的,这是行不通的。

I've been looking through the documentation and googling, and I've found the way to change the default directory (by modifying upload.class.php) but since I need this to be dynamic, that doesn't work.

我想必须有一个方法来一个POST变量添加到Ajax调用会激活PHP脚本,但我甚至不能找出这些Ajax调用。我甚至不能找到整个code的引用,无论是PHP文件(的index.php和upload.class.php)的。

I figure there has to be a way to add a POST variable to the ajax calls which activate the php scripts, but I can't even find out where those ajax calls are. I can't even find a reference to either of the php files (index.php and upload.class.php) throughout the code.

这是如何做到这一点任何想法?

Any ideas on how to accomplish this?

推荐答案

在表单中,添加一个字段是这样的:

In your form, add a field like this:

<input type="hidden" name="path" value="<?echo $_GET['path'];?>">

而在你的PHP所在的文件上传时,只提取路径以:

And in your PHP where the file is uploading, just extract the path with:

$path = $_POST['path'];

只是把它在PHP脚本中指定的路径。

Just put the path where it is specified in the PHP script.

这篇关于jQuery的文件上传插件:动态改变上传路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 00:06