我正在尝试将 Uploadify 实施到我的网站项目中,该项目已经有一个非常基本的文件上传系统。我已将uploadify 配置为提交表单帖子,该表单帖子传输到后端上传php 脚本以进行图像的上传和排序。但是,上传后我什么也没得到,$_FILES 数组完全是空白的,Uploadify 论坛和文档根本没有帮助。这是我的代码:
前端上传页面
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"> </script>
<script type="text/javascript" src="/modules/default/themes/uploadify/jquery.uploadify- 3.1.min.js"></script>
<script type="text/javascript">
$(function() {
$('#file_upload').uploadify({
'fileTypeDesc' : 'Image Files',
'fileTypeExts' : '*.jpg; *.jpeg; *.png; *.gif',
'method' : 'post',
'auto' : false,
'swf' : '/modules/default/themes/uploadify/uploadify.swf',
'uploader' : '/modules/default/themes/uploadify/uploadify.php',
'onUploadComplete' : function(file, event, ID, fileObj, response, data) {
$('#pff').submit();
},
});
});
//Further down the line
<form action="<?php echo $this->url('upload')?>" method="post" id="pff" enctype="multipart/form-data">
<div class="uploadfield">
<input type="file" name="pics" id="file_upload" />
</div>
</form>
<a href="javascript:$('#file_upload').uploadify('upload')">Upload Files</a>
后端PHP上传脚本段
$errors = array();
$uploaded = array();
$ids = array();
$public = $this->app->config->upload_public_default;
$user = $this->app->userSession->user;
$gallery = $this->app->getParamInt('gallery_id');
$userid = $user->user_id;
if(!empty($_FILES['Filedata']['tmp_name']) && $this->app->config->allow_uploads){
//Code to upload the images to the user accounts
}
几个小时以来,我一直在尝试各种不同的事情,以及来自不同网站和论坛的大量建议。没有任何工作或提示我该做什么。我似乎无法将文件传递给脚本。