Comments (3)
Hi, sorry for the delay, I've been busy.
Can you give me an example of your code or the error that you're getting?
from synology.
Hi,
Thanks for your answer it's my code
/**
* This file is an example on how to use Synology_Api
*/
set_include_path(dirname(__FILE__).'/library'.PATH_SEPARATOR.get_include_path());
function __autoload($class_name) {
$path = str_replace('_', DIRECTORY_SEPARATOR, $class_name);
include $path . '.php';
}
$synology = new Synology_FileStation_Api('my_own_server', 5000, 'http', 1);
//$synology->activateDebug();
$synology->connect('christophe.dupasquier', '************');
$test = $synology->getList($path="/MANU");
//print_r($test);
function parcourir_array($tableau){
foreach($tableau as $key => $value){
{
if(is_array($value) || is_object($value)){
parcourir_array($value);
}
else
{
if($key=='name' && $tableau->isdir != 1 ){
echo $tableau->name.' '.$tableau->path.'<br/>';
/* if($key=='name' && $tableau->isdir != 1 ){
echo $tableau->name.'<br/>';
} */
}
}
}
}
}
parcourir_array($test);
$path2 = "/MANU/logoAmaneo.jpg";
echo $synology->download($path2);
The variable $path2 really exist and is functionnally with another method...
Where is my problem ? Thank you for time you take to answer me...
from synology.
Can you try this code instead:
<?php
/**
* This file is an example on how to use Synology_Api
*/
set_include_path(dirname(__FILE__).'/library'.PATH_SEPARATOR.get_include_path());
function __autoload($class_name) {
$path = str_replace('_', DIRECTORY_SEPARATOR, $class_name);
include $path . '.php';
}
$synology = new Synology_FileStation_Api('my_own_server', 5000, 'http', 1);
$synology->activateDebug();
$synology->connect('christophe.dupasquier', '************');
// need to disable debug
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="logoAmaneo.jpg"'); //<<< Note the " " surrounding the file name
header('Content-Transfer-Encoding: binary');
header('Connection: Keep-Alive');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
echo $synology->download('/MANU/logoAmaneo.jpg');
Also keep in mind that when you set headers, you cannot "echo"/"print" anything before them.
from synology.
Related Issues (17)
- Example for DSM HOT 4
- Problem on login with new DSM 5.1 HOT 4
- destination option in downloadStation Api
- Authentication fails if secure
- Help request
- Throw error codes instead of exceptions
- Composer integration HOT 2
- Surveillance Station API -> SetCameraSchedule HOT 1
- FileStation: Split out additional data into separate arrays HOT 2
- class Synology_Abstract (Abstract.php) contains never used private $_errorCodes HOT 2
- Note Station API
- Class "Synology\Api" not found
- does this still work? HOT 1
- Connect timeout HOT 1
- Cannot connect to Synology HOT 1
- Added support for BT Search HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from synology.