Hallo,
wie der Titel schon sagt lade ich Bilder über die API zu Flickr hoch.
Das klappt soweit auch, nur brauche ich die richtige Bildurl anschließend.
Das will einfach nicht klappen!
Jemand eine Idee wie das auf meinen Code anzuwenden wäre?
wie der Titel schon sagt lade ich Bilder über die API zu Flickr hoch.
Das klappt soweit auch, nur brauche ich die richtige Bildurl anschließend.
Das will einfach nicht klappen!
Jemand eine Idee wie das auf meinen Code anzuwenden wäre?
PHP-Code:
<?php
require_once("phpFlickr.php");
$error=0;
$f = null;
if($_POST){
if(!$_POST['name'] || !$_FILES["file"]["name"]){
$error=1;
}else{
if ($_FILES["file"]["error"] > 0){
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}else if($_FILES["file"]["type"] != "image/jpg" && $_FILES["file"]["type"] != "image/jpeg" && $_FILES["file"]["type"] != "image/png" && $_FILES["file"]["type"] != "image/gif"){
$error = 3;
}else if(intval($_FILES["file"]["size"]) > 525000){
$error = 4;
}else{
$dir= dirname($_FILES["file"]["tmp_name"]);
$newpath=$dir."/".$_FILES["file"]["name"];
rename($_FILES["file"]["tmp_name"],$newpath);
$status = uploadPhoto($newpath, $_POST["name"]);
if(!$status) {
$error = 2;
}
}
}
}
function uploadPhoto($path, $title) {
$apiKey = "geheim";
$apiSecret = "strenggeheim";
$permissions = "write";
$token = "nochvielgeheimer";
$f = new phpFlickr($apiKey, $apiSecret, true);
$f->setToken($token);
print_r($f);
return $f->async_upload($path, $title);
}
?>
<form action="txt2html.php" method="post" accept-charset="utf-8" enctype='multipart/form-data'>
<input type="file" name="file"/><br />
<input type="submit" value="Submit" /><br />
</form>

Kommentar