The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
Dropbox & Composer help - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28)
+--- Forum: Off-topic Discussions (https://userspice.com/forums/forumdisplay.php?fid=10)
+--- Thread: Dropbox & Composer help (/showthread.php?tid=1135)



Dropbox & Composer help - waynebr - 09-06-2018

Hi All,

I have just upgraded my Userspice to the latest version after being many version behind. I have got most of my site working but appear to be having an issue with on part. I currently have a process that uploads a file to Dropbox - this is based on the following guide / files https://github.com/kunalvarma05/dropbox-php-sdk/wiki/Upload-and-Download-Files.

For some reason with the update this script has stopped working and I can't figure out why. Can anyone help? The file gets created but does not upload and stops at the creation step. It worked perfectly in my previous version.

Looking through my code I have attached the point at which I think it stops if anyone can see anything obvious.

$file = "post/$filename.csv";

file_put_contents($file, $csv);
chmod($file, 0777);

require __DIR__ . '/vendor/autoload.php';
use Kunnu\Dropbox\Dropbox;
use Kunnu\Dropbox\DropboxApp;
use Kunnu\Dropbox\DropboxFile;
use Kunnu\Dropbox\Exceptions\DropboxClientException;

//Configure Dropbox Application
$app = new DropboxApp("XXXXXXXXXX", "XXXXXXXXX", "XXXXXXXXXXXXX");

//Configure Dropbox service

$pathToLocalFile = __DIR__ . "/post/$filename.csv";
$dropbox = new Dropbox($app);

$dropboxFile = new DropboxFile($pathToLocalFile);
$file = $dropbox->upload($dropboxFile, "/apps/clickanddrop/$filename.csv", ['autorename' => true]);

//Uploaded File
$file->getName();
?>
<div id="page-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<h1>Shipping File Upload</h1>
<!-- Content Goes Here. Class width can be adjusted -->
              <div class="alert alert-success">
  <strong>Success!</strong> <a href="https://business.parcel.royalmail.com/" target="blank" class="alert-link">Click Here To Print Labels</a>.
                <?php header( "refresh:30;url=$us_url_root./users" ); ?>
</div>
<!-- End of main content section -->
</div> <!-- /.col -->
</div> <!-- /.row -->
</div> <!-- /.container -->
</div> <!-- /.wrapper -->


RE: Dropbox & Composer help - Brandin - 09-06-2018

Remove the refresh URL and try to find out if there are any errors. Do a dump on $file to see what is shown.

Brandin.


RE: Dropbox & Composer help - waynebr - 09-06-2018

Hi Brandin,

Thanks for the quick response, I already tried to dump $file and it gives me the correct name. It doesn't get as far the as the refresh URL but I just removed it and tried to check and its the same.


RE: Dropbox & Composer help - waynebr - 09-06-2018

I'm still trying to get this to work, i'm guessing it is something to do with composer as if I remove the composer parts of this script then everything else works and I can download the file.

I know that there was some big changes if anyone is good with composer the help would be great so I can figure out whats causing it to fail.


RE: Dropbox & Composer help - Brandin - 09-06-2018

Unfortunately I'm terrible with composer. Have you tried removin the package and readding it? Also I would suggest checking the F12 Developer Tools Menu to watch the Network as you hit the page and it completes the upload (unless the server does this on the clients behalf...?)


RE: Dropbox & Composer help - waynebr - 09-06-2018

Thanks I have tried re-adding it but i'm not getting any joy Sad