Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 我能';t使用Uploadify将文件上载到我的服务器_Php_Uploadify - Fatal编程技术网

Php 我能';t使用Uploadify将文件上载到我的服务器

Php 我能';t使用Uploadify将文件上载到我的服务器,php,uploadify,Php,Uploadify,我在尝试将文件上载到服务器时遇到问题。我使用插件将文件上传到我的服务器上,然后将文件名存储在数据库中 问题是uplodify的行为就像文件已上载,没有错误,但没有上载任何内容 我在Windows2008R2服务器上运行PHP 下面是我处理实际上传的php代码 <?php require("../requires/LDAP_connection.php"); require("../requires/APP_configuration.php"); require("../requires

我在尝试将文件上载到服务器时遇到问题。我使用插件将文件上传到我的服务器上,然后将文件名存储在数据库中

问题是uplodify的行为就像文件已上载,没有错误,但没有上载任何内容

我在Windows2008R2服务器上运行PHP

下面是我处理实际上传的php代码

<?php

require("../requires/LDAP_connection.php");
require("../requires/APP_configuration.php");
require("../requires/PHP_generic_functions.php");

//Include connection class
require('../classes/connection.php');
require('../requires/user_authentication.php');  //this file must be placed under the connection class NOT before

define('ROOT_SYS', dirname(__FILE__).'/');

// Define a destination
$targetFolder = '';
$verifyToken = '100';
$actualToken = '';
$fileTypes = array('jpg','jpeg','gif','png');

if(isset($_POST['upload_path'])){
    $targetFolder = $_POST['upload_path'];
}

if(isset($_POST['timestamp'])){
    $verifyToken = md5($_POST['timestamp']);
}

if(isset($_POST['token'])){
$actualToken = $_POST['token'];
}

if(isset($_POST['allowed_extentions'])){

    $types = explode(',', $_POST['allowed_extentions']);

    if(count($types) > 0 ){
        $fileTypes = $types;
    }
}


if (!empty($_FILES) && $actualToken == $verifyToken) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath =  ROOT_SYS . $targetFolder;   //$_SERVER['DOCUMENT_ROOT']
    $new_filename = USER_ID . '_' . time() . '_' . str_replace(" ", "_", $_FILES['Filedata']['name']);
    $targetFile = $targetPath . $new_filename;

    // Validate the file type
    //$fileTypes = array('jpg','jpeg','gif','png'); // File extensions
    $fileParts = pathinfo($new_filename);  //str_replace(" ", "_", $_FILES['Filedata']['name'])

    if (in_array($fileParts['extension'],$fileTypes)) {
        move_uploaded_file($tempFile,$targetFile);
        echo trim($new_filename);
    } else {
        echo 'INVALID';
    }
}
?>

下面是我的javascript

<?php $timestamp = time();?>

    <script type="text/javascript">
    $(function() {
        $('#file_upload').uploadify({
            'formData'     : {
                'timestamp' : '<?php echo $timestamp;?>',
                'token'     : '<?php echo md5($timestamp);?>',
                'upload_path': 'add-ons/ticketing_system/uploads/',
                'allowed_extentions': 'jpg,jpeg,gif,PNG,JPG,png,zip,rar,doc,docx,cvs,xls,xlsx,txt'
            },
            'auto' : true,
            'swf'      : '../../includes/uploadify.swf',
            'uploader' : '../../includes/uploadify.php',
            'fileSizeLimit' : '10MB',
            'fileTypeExts' : '*.gif; *.jpg; *.JPG; *.png; *.PNG *.zip; *.rar; *.doc; *.docx; *.cvs; *.xls; *.xlsx; *.txt;',
            'onUploadSuccess' : function(file, data, response) {
                if(data != 'INVALID'){
                    $('#attached_files').append('<input type="hidden" name="attachments[]" value="'+ $.trim(data) +'" />');
                } else {

                    alert('Invalid File Type');
                }
            }

        });
    });
</script>

$(函数(){
$('#文件上传')。上传({
“formData”:{
“时间戳”:“,
“令牌”:“,
“上传路径”:“附加组件/票务系统/上传/”,
“允许的扩展名”:“jpg、jpeg、gif、PNG、jpg、PNG、zip、rar、doc、docx、cvs、xls、xlsx、txt”
},
“自动”:正确,
“swf”:“../../includes/uploadify.swf”,
“uploader”:“../../includes/uploadify.php”,
'fileSizeLimit':'10MB',
“fileTypeExts”:“*.gif;*.jpg;*.jpg;*.png;*.png*.zip;*.rar;*.doc;*.cvs;*.xls;*.xlsx;*.txt;”,
“onUploadSuccess”:函数(文件、数据、响应){
如果(数据!=“无效”){
$(“#附件”)。附加(“”);
}否则{
警报(“无效文件类型”);
}
}
});
});
我做错了什么?为什么它没有上传任何东西,也没有给我任何错误


谢谢,Uploadify有一个调试模式可以帮助您解决以下问题:


我通常查找的是权限错误……可能还有您的身份验证方法。

谢谢您的提示。我只是打开调试模式,但我不确定我应该在这里寻找什么。一切看起来都很正常。有什么我应该找的吗?