0

Actually i want to send zip file to the dropbox .But when i try to open my file using fopen then this issue comes. fopen(www.cloud01.wptemplate.net_09_10_2015_16_1444437876.zip): failed to open stream: No such file or directory in /home/cle1296/cloud01.wptemplate.net/wp-content/plugins/wp-cloud-safe/includes/UltimateBackup.php on line 830. My server is dreamhost.I execute the same code on another server and don't face any issue.It seems that dreamhost disabled the fopen function.So kindly give me an alternative way

 function sendToDropbox() {

    try {

        $this->log('Sending file to DropBox');
       $dbxClient = new dbx\Client($this->dropboxGeneratedAccessToken, "PHP-Example/1.0");


        $f = fopen($this->backupFilename, "r+");


        $dbxClient->uploadFile($this->dropboxUploadPath . $this->backupFilename, dbx\WriteMode::add(), $f);

    } catch (Exception $e) {



        $this->log('ERROR while uploading file to DropBox');

    }

}
Shaniawan
  • 243
  • 2
  • 16
  • 1
    I use DreamHost as well and I can assure you that there is no such thing as *"my webhost must have disabled the function X because I've got an error"*. Look to your error message again. – al'ein Oct 09 '15 at 18:16
  • As Alan stated, function is indeed working. Problem is that file is not there. – viktor77 Oct 09 '15 at 18:18
  • i tried a lot but got struck on that issue.If this not a DreamHost problem then why my script is working well on another server..i will be thankful to you for your help – Shaniawan Oct 09 '15 at 18:22
  • @viktor77.I assure you file exists. :) – Shaniawan Oct 09 '15 at 18:23
  • Do this, then: implement the function described in [this answer](http://stackoverflow.com/questions/3938120/check-if-exec-is-disabled) and deploy it at your webhost (change 'exec' to 'fopen'), then execute it. If it returns you `true`, it's enabled. If `false`, disabled (beware that `ini_get()` can be also disabled to prevent internal config sniffing). – al'ein Oct 09 '15 at 18:25
  • i check it.it return true.But will you please tell me why this is working fine on another servers.What will be the issue.Thanx for helping. – Shaniawan Oct 09 '15 at 18:31

1 Answers1

0

The path to the file obviously is not correct, either because the file does not exist or simply what you passed to fopen() is not the actual location of the backup. Use the full path to the file to be absolutely sure, for example if your backup is at:

/home/cle1296/cloud01.wptemplate.net/my_backups/backup.zip

...then make sure to pass it to your fopen() and you shouldn't have any issues.

Oliver Maksimovic
  • 3,204
  • 3
  • 28
  • 44
  • Now i change the file path as you said. But it is again giving me the same error.Here is my code. $f = fopen("/home/cle1296/cloud01.wptemplate.net/wp-content/plugins/wp-cloud-safe/lib/testing.zip", "r+"); – Shaniawan Oct 09 '15 at 18:44
  • if you're 100% sure that the path is valid 100%, then maybe backup file's permissions are too strict. use FTP or SSH to change it's permissions to 755 and check again... – Oliver Maksimovic Oct 09 '15 at 19:05