dstnlhhv791576 2010-07-29 14:22
浏览 85
已采纳

如何使用CURL POST直接将文件流上传到Flickr?

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:

<?php

require_once("phpFlickr.php");
$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?

  • 写回答

1条回答 默认 最新

  • douweng5420 2010-08-03 10:54
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 想用@vueuse 把项目动态改成深色主题,localStorge里面的vueuse-color-scheme一开始就给我改成了dark,不知道什么原因(相关搜索:背景颜色)
  • ¥20 OPENVPN连接问题
  • ¥15 flask实现搜索框访问数据库
  • ¥15 mrk3399刷完安卓11后投屏调试只能显示一个设备
  • ¥20 白日门传奇少一个启动区服和启动服务器的快捷键,东西都是全的 , 他们说套一个出来就行了 但我就是弄不好,谁看看,
  • ¥100 如何用js写一个游戏云存档
  • ¥15 ansys fluent计算闪退
  • ¥15 有关wireshark抓包的问题
  • ¥15 需要写计算过程,不要写代码,求解答,数据都在图上
  • ¥15 向数据表用newid方式插入GUID问题