我想實施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
}
我一直在努力各種各樣的不同幾個小時的事情,以及來自不同網站和論壇的大量建議。沒有任何工作或給我暗示要做什麼。我似乎無法將文件傳遞給腳本。
我原來有'圖片'在那裏,它仍然返回一個空的數組。 – aschmelyun
那麼你有一個地方的錯誤。打開錯誤報告或檢查你的error.log – slash197