2013-08-13 3 views
0

Я искал много сообщений, чтобы решить мою проблему, пробовал много вещей, и это не сработало для меня. Проблема в том, что я пытаюсь загрузить файл с демонстрационной страницей, предоставленной плагином Uploadify (v3.2.1), и он говорит, что загрузка завершена, но я не вижу файл на сервере.Uploadify 3.2.1 говорит, что файл загружен, но не видит его

Во-первых, давайте скажем, что я изменил php.ini в моей папке public_html установить путь к upload_tmp_dir и session.savepath. Я настроил как это: /дома/Ensembl/public_html/ОКАЗАНИЕ/uploadTemp

Затем в папке public_html снова, я создал файл .htaccess и написал эту строку в нее: suPHP_ConfigPath/home/ensembl/public_html/, чтобы применить изменения ко всем файлам и подпапкам.

Все папки имеют 0755 разрешения и все файлы имеют 0644.

ли кто-то видит, что случилось?

Там он идет код, который я есть сейчас:

index.php

<!DOCTYPE HTML> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<title>UploadiFive Test</title> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> 
<script src="jquery.uploadify.min.js" type="text/javascript"></script> 
<link rel="stylesheet" type="text/css" href="uploadify.css"> 
<style type="text/css"> 
body { 
    font: 13px Arial, Helvetica, Sans-serif; 
} 
</style> 
</head> 

<body> 
    <h1>Uploadify Demo <?php 
    //The following line is just to show the paths 
    echo $_SERVER['DOCUMENT_ROOT'].'/downloadsUploadify/'.'<br/>'.sys_get_temp_dir().' | '.ini_get('upload_tmp_dir');?></h1> 
    <form> 
     <div id="queue"></div> 
     <input id="file_upload" name="file_upload" type="file" multiple="true"> 
    </form> 

    <script type="text/javascript"> 
    $(function() { 
     $('#file_upload').uploadify({ 
      'swf'   : 'uploadify.swf', 
      'uploader'  : 'uploadify.php', 
      'fileSizeLimit' : '20MB', 
      'fileTypeExts' : '*.jpg; *.jpeg; *.gif; *.png; *.mp3; *.pdf; *.txt', 
      'removeTimeout' : 60, 
      'removeCompleted' : false, 
      'requeueErrors' : true, 
      'onUploadComplete' : function(file) { alert('The file ' + file.name + ' finished processing.'); }, 
      'onUploadError' : function(file, errorCode, errorMsg, errorString) { alert('The file ' + file.name + ' could not be uploaded: ' + errorString); }, 
      'onUploadSuccess' : function(file, data, response) { alert('The file ' + file.name + ' was successfully uploaded with a response of ' + response + ':' + data); } 
     }); 
    }); 
    </script> 
</body> 
</html> 

Результат sys_get_temp_dir() =>/TMP

Результат ini_get ('upload_tmp_dir') =>/home/ensembl/public_ht мл/ОКАЗАНИЕ/uploadTemp

uploadify.php

<?php 
/* 
Uploadify 
Copyright (c) 2012 Reactive Apps, Ronnie Garcia 
Released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/ 

// Define a destination 
$targetFolder = '/downloadsUploadify/'; // Relative to the root 

$verifyToken = md5('unique_salt' . $_POST['timestamp']); 

if (!empty($_FILES) && $_POST['token'] == $verifyToken) { 
    $tempFile = $_FILES['Filedata']['tmp_name']; 
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder; 
    $targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name']; 

    // Validate the file type 
    $fileTypes = array('jpg','jpeg','gif','png','mp3', 'pdf', 'txt'); // File extensions 
    $fileParts = pathinfo($_FILES['Filedata']['name']); 

    if (in_array($fileParts['extension'],$fileTypes)) { 
     move_uploaded_file($tempFile,$targetFile); 
     echo '1'; 
    } else { 
     echo 'Invalid file type.'; 
    } 
} 
?> 

регистрация exists.php

<?php 
/* 
Uploadify 
Copyright (c) 2012 Reactive Apps, Ronnie Garcia 
Released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/ 

// Define a destination 
$targetFolder = '/downloadsUploadify/'; // Relative to the root and should match the upload folder in the uploader script 

if (file_exists($_SERVER['DOCUMENT_ROOT'] . $targetFolder . '/' . $_POST['filename'])) { 
    echo 1; 
} else { 
    echo 0; 
} 
?> 

ответ

0

В index.php в <script><?php $timestamp = time();?>, и в функции Uploadify, вы должны добавить следующее:

'FormData' : { 
    'timestamp': '<? php echo $ timestamp;>', 
    'token': '<? php echo md5 (' unique_salt '$ timestamp.)>' 
}, 

documentation

TargetFolder должны использовать прямой адрес к папке, в которой хранятся пример изображения:

/5/uploadify/archivos /

Смежные вопросы