Jump to content
php.lv forumi

uploadify uploaders


ziedinjsh

Recommended Posts

Sveiki.. Lejupielādēju failu uploaderi no www.uploadify.com/

Tur bija js, swf, php un css faili.. ieliku viņus misc mape un pēc tam index.php ieliku šādu kodu:

<input id='fileInput' name='fileInput' type='file' />
<script type='text/javascript'>
$(document).ready(function() {
$('#fileInput').uploadify({
'uploader'  : 'misc/uploadify.swf',
'script'    : 'misc/uploadify.php',
'cancelImg' : 'misc/cancel.png',
'auto'      : true,
'folder'    : '/mp3'
});
});

upload poga parādās.. izvēlos failu.. parāda ka 100% uzlādēts.. complete. Bet fails folderā nav!

 

tur vēl bija šādi php:

postify.php:

<?php

if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];

// $fileTypes  = str_replace('*.mp3','',$_REQUEST['fileext']);
// $fileTypes  = str_replace(';','|',$fileTypes);
// $typesArray = split('\|',$fileTypes);
// $fileParts  = pathinfo($_FILES['Filedata']['name']);

// if (in_array($fileParts['extension'],$typesArray)) {
	// Uncomment the following line if you want to make the directory if it doesn't exist
	// mkdir(str_replace('//','/',$targetPath), 0755, true);

	move_uploaded_file($tempFile,$targetFile);
	echo "1";
// } else {
// 	echo 'Invalid file type.';
// }
}
?>

un check.php

<?php

$fileArray = array();
foreach ($_POST as $key => $value) {
if ($key != 'folder') {
	if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_POST['folder'] . '/' . $value)) {
		$fileArray[$key] = $value;
	}
}
}
echo json_encode($fileArray);
?>

skatījos js failos, tur nekur nebija jānorāda failu folderis.. kas varētu būt pa problēmu?

Link to comment
Share on other sites

tad man jānorādā šadi kaut kā:

$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . 'http://domens.lv/mp3/';

 

kaut kā tā?

 

es tā paprovēju.. vienalga neparādās fails.. postify.php atrodas misc folderā un mp3 folders man atrodas vienu folderi uz atpakaļu.. tad es pameiģināju šādi:

$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder']  '../mp3';

vienalga neiet

Edited by ziedinjsh
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...