如何将文件从codeigniter应用程序上传到dropbox [英] how to upload file from codeigniter app to dropbox

查看:156
本文介绍了如何将文件从codeigniter应用程序上传到dropbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个控制器可以将图片上传到我的网络服务器。我想在该过程中将该图片上传到Dropbox。我将如何做呢?

I have a controller to upload image to my web server. I want to upload that image to dropbox as well during the process. how would I do it?

这是我简单的upload.php控制器:

This is my simple upload.php controller:

function index() {
    // get the binary data
    $file = file_get_contents("php://input");

    // prepare new name for upload image
    $name =rand().time().'jpg';

    $path = site_url('photo');

    // save to server directory
    file_put_contents($path.$name, $file);

    // save the name and id of the post to post photo table
    $input =  array(    'name' => $name,
                        'post_id'=> $id
                    );

    $this->db->insert('post_photo', $input);

}


推荐答案

有完整的教程

如何使用Dropbox api与编码器,使用 This CodeIgniter-Dropbox-API-Library

This blogpost has complete tutorial
how to use Dropbox api with codigniter using THIS CodeIgniter-Dropbox-API-Library

http://jimdoescode.blogspot.com/2011/07/codeigniter-dropbox-api.html

这篇关于如何将文件从codeigniter应用程序上传到dropbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆