jQuery文件上传DELETE文件错误

时间:2017-03-27 12:05:39

标签: php jquery jquery-file-upload

我设法通过在upload.php上使用表单中的隐藏输入发布值来成功上传jQuery文件(基本和UI)以成功上传到自定义文件夹

<input type="hidden" name="referrer" id="referrer" value="12345">
<input type="hidden" name="transaction" id="transaction" value="54321">

然后在index.php中检索这些值并用于创建全局变量

$GLOBALS['referrer'] = $_POST['referrer'];
$GLOBALS['transaction'] = $_POST['transaction'];

然后在uploadHandler.php中使用它来创建自定义目录以将图像上传到

'upload_dir' => '../../uploads/'.$GLOBALS['referrer'].'/'.$GLOBALS['transaction'].'/',
'upload_url' => '../../uploads/'.$GLOBALS['referrer'].'/'.$GLOBALS['transaction'].'/',

上传时效果很好但是当我尝试使用upload.php上的删除按钮删除文件时,我收到了这些错误

Undefined index: referrer in /home/tatty27/public_html/disender/server/php/index.php
Undefined index: transaction in /home/tatty27/public_html/disender/server/php/index.php

如果我使用会话来存储值而不是变量,我不会收到此错误但是我担心如果上传需要很长时间会话会超时。我们的一些用户有非常大的文件(1GB以上)上传和非常差的互联网连接因此我使用这个插件的原因。

如果没有我担心什么,会在文件上传时或者如果他们连接几分钟后会话保持活动状态吗?

0 个答案:

没有答案