kelvinrolex's avatar

Laravel 5 Dropbox

Please I want to be able to upload a zip file from my server to my drop box account, i have setup the dropbox filesystem in Laravel 5 and it working well, I can put a file and also can read a file, but the problem now is, i don't know which of the filesystem methods to use if i want to upload my zip file located in my server to my dropbox account. Please help.

0 likes
11 replies
dschniepp's avatar

Did you use the disks like ->disk('dropbox') vs. ->disk('local')? For an example check Jeffery's tutorial Multiple Filesystems, the video explains the multi disk functionality pretty well.

kelvinrolex's avatar

Yes i did $filesystem->disk('dropbox')->put('test.txt', 'hello'); and its working very well, but in this situation I am not reading and updating the content of the file, all i just want to do is to upload the zip file to Dropbox server. I have tried the other methods but didn't work e.g: get() prepend() append() copy() move()

etc, please i don't know if there is an upload() method.

dschniepp's avatar

Can you try the following code:

$content = $filesystem->disk('local')->get('test.txt');
$filesystem->disk('dropbox')->put('test.txt', $content);

Because this is the process described by the package behind the new Laravel 5 Filesystem: Flysystem

kelvinrolex's avatar

Ok, but what am actually looking for is a method that can upload a file to drop box from my local server, so far i have tried the move and copy for dropbox but where it states that i should put the from path, if i use a local file path it will tell me file not found because the path must be from your dropbox account

bashy's avatar

Explain where "local server" is located. They gave you a code example for that already?

kelvinrolex's avatar

This particular one is different, what I working with is a zip file not .txt file so put method won't work. $content = $filesystem->disk('local')->get('test.zip'); $filesystem->disk('dropbox')->put('test.zip', $content);

dschniepp's avatar

Ah ok got it. I guess it's not possible out of the box, because streaming is missing. You could try to to extend the FilesytemAdapther.php with writeStream() and writeStream() to recover the functionality described here Using streams for reads and writes.

xingfucoder's avatar

Trying it I get the following error:

 Call to undefined method Illuminate\Filesystem\FilesystemManager::createDriver()

If someone can try it and tell us if it works.

Please or to participate in this conversation.