如何更改jquery文件上传的默认上传路径 [英] How do I change the default upload path for jquery file upload
问题描述
我已经使用php框架实现了jQuery文件上传插件,按照说明进行操作相对简单.
I have implemented the jQuery file upload plugin with a php framework it was relatively straight forward following the instructions.
https://github.com/blueimp/jQuery-File-Up
我的问题专门针对PHP类,当图像上传时,它们上传到我的框架文件夹(在其中执行php脚本).我想知道的是,是否有一种方法可以设置将图像上传到的路径.
My question is specifically towards the PHP class, When the images upload they upload into my framework folder (where the php script is executed). What I want to know is if there is a way to set the path where images will be uploaded to.
这是有问题的课程.
https://github.com/blueimp/jQuery-File-Upload/blob/master/server/php/UploadHandler.php
它包含在jQuery文件上传存储库中.
It is included in the jQuery file upload repository.
推荐答案
您可以通过两种方式进行操作: 1 ..通过更改server/php/UploadHandler.php中的第40行并将所需目录放在
You can do it in two ways: 1.. by changing the line 40 in server / php / UploadHandler.php and put the directory you want
'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/',
2 ..通过在初始化类时添加上载目录作为参数
2.. by adding the upload dir as parameter when initializing the class
$options = array ('upload_dir' => dirname(__FILE__) . '/uploaddir/');
$upload_handler = new UploadHandler($options);
这篇关于如何更改jquery文件上传的默认上传路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!