PHP bir Facebook uygulaması yazdı ve kullanıcı benim sunucuya bir resim yüklemek için izin gerekiyor. Ben bu kodu kullanmış:
<?php
include_once('facebook.php');
$appapikey = 'API KEY HERE';
$appsecret = 'SECRET KEY HERE';
$facebook = new Facebook($appapikey, $appsecret);
$fb_user = $facebook->require_login();
if((!empty($_FILES["uploaded_file"])) && ($_FILES['uploaded_file']['error'] == 0)) {
$filename = basename($_FILES['uploaded_file']['name']);
$ext = substr($filename, strrpos($filename, '.') + 1);
if (($ext == "jpg") && ($_FILES["uploaded_file"]["type"] == "image/jpeg") &&
($_FILES["uploaded_file"]["size"] < 350000)) {
$newname = dirname(__FILE__).'/upload/zbt_'.$fb_user.'.jpg';
if ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$newname))) {
header("Location: http://majik.zbrowntechnology.info/display.php");
} else {
header("Location: home.php?Fatal");
}
} else {
header("Location: home.php?Fatal");
}
} else {
header("Location: home.php?Fatal");
}
?>
but am not able to actually save the file in the directory. I have done some playing around with the code and think the problem lies in the moving of the file in this line:
if ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$newname))) {....