frank1 has asked for the wisdom of the Perl Monks concerning the following question:
i have a problem of uploading files to Dropbox, this is the error i get
[WebService::Dropbox] [ERROR] https://content.dropboxapi.com/2/files/u +pload {"path":"/Uploads/$filename"} -> [400] Error in call to API fun +ction "files/upload": Must provide HTTP header "Authorization" or URL + parameter "authorization". at WebService/Dropbox.pm line 184.
My full code
#!/usr/bin/perl use lib '.'; use strict; use warnings; use WebService::Dropbox; use IO::File; my $filename = '/var/www/vhosts/path/httpdocs/path/file.txt'; my $access_token = ''; my $dropbox = WebService::Dropbox->new({ key => $access_token, # oauth2 is true by default for recent versions }); my $local_file = $filename; my $remote_path = '/Uploads/$filename'; my $content = IO::File->new($local_file, '<') or die "Cannot open $loc +al_file: $!"; my $result = $dropbox->upload($remote_path, $content); if ($result) { print "Successfully uploaded $local_file to Dropbox as $remote_pat +h\n"; } else { die "Upload failed: " . $dropbox->error; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dropbox problem
by talexb (Chancellor) on Dec 24, 2025 at 15:18 UTC | |
by frank1 (Monk) on Dec 24, 2025 at 15:51 UTC | |
|
Re: Dropbox problem
by pryrt (Abbot) on Dec 24, 2025 at 16:39 UTC | |
by frank1 (Monk) on Dec 24, 2025 at 17:01 UTC |