JavaScript — Загрузить путь к файлу назначения

Привет, я работаю с этим загружать вещи, и я не понимаю это правильно. Я проверил код и не нашел ошибок. это действительно сводит меня с ума сейчас. Папка, в которой находится папка «E: \ xampp \ htdocs \ officework \ uploadify \ uploads», где «uploads» — это имя папки моего назначения. Мне действительно нужна твоя помощь. большое спасибо
Ее код
upload.php

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Uploadify</title><script type="text/javascript" src="uploadify/jquery.uploadify.min.js"> </script>
<script type="text/javascript" src="uploadify/uploadify.css"> </script>
<script type="text/javascript" src="uploadify/check-exists.php"> </script>
<script type="text/javascript" src="uploadify/uploadify.swf"> </script>
<script type="text/javascript" src="uploadify/jquery.uploadify.js"></script>
<script type="text/javascript" src="uploadify/uploadify.php"> </script>
<script type="text/javascript" src="uploadify/uploadify-cancel.png"> </script>
<script>
$(document).ready(function(){
$('#file_upload').uploadify({
'fileObjName' : 'the_files',
'method' : 'post',
'swf': 'uploadify/uploadify.swf',
'uploader': 'uploadify/uploadify.php',
'check' : '  uploadify/check-exists.php',
'canceling':'uploadify/uploadify-cancel.png',
'formData' : {'uploads':'localhost/officework/uploadify'},
//'folder' : '/uploads',

'onUploadStart' : function(file) {
alert('Starting to upload ' + file.name);
},
'onUploadComplete': function(event, queueID, fileObjName, response, data)

{
alert ('you have uploaded ' + fileObj.name + ' to ' + fileObj.filePath + '.');
filename="+fileObj.name+"&targetpath="+fileObj.targetPath; //Here you can do a javascript redirect
},

'onUploadSuccess' : function(file, data, response) {
alert('The file with name'+file.name + 'was saved to with response:' + response +':'+ data);
}});

});
</script>
</head>

<body><input type="file" name="file_upload" id="file_upload" /></body>
</html>

uploadify.php

$targetFolder = '/uploads'; // 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'); // 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

$targetFolder = '/uploads'; // 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

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]