php - How do I directly upload a file stream to Flickr using a CURL POST?


I'm writing a web app that at one point allows a user to upload a photo to a flickr account (mine). I want to do this without saving the intermediate image on the server my web app is on.

What I've got so far is a page which implements phpFlickr and accepts a POST from a simple html form. I use$_FILES['file']['tmp_name'] as the path for phpFlickr to use. Here's the code:


$f = new phpFlickr("apikey", "secret", true);

$_SESSION['phpFlickr_auth_redirect'] = "post_upload.php";

$myPerms = $f->auth("write");

$token = $f->auth_checkToken();

$phid = $f->sync_upload($_FILES['file']['tmp_name']);

echo "Uploading Photo..." . $phid;


I'm guessing that the tmp file is being lost because of the redirect that happens when$f->auth("write") is called, but I don't know. Is there a way to preserve it? Is there any way to do this without saving the file to the server?




Answer: There is No way to directly upload a file to Flickr without saving it as an intermediate file.

I've moved on to using move_uploaded_file() followed by a flickr API call, and its working perfectly.

I've also managed to get it to play nice with the excellent Jquery Uploadify, which lets me send multiple files to it in one go.

People are also looking for solutions to the problem: php - How can I parse flashvars from string


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.