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 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示