File indexing completed on 2024-12-22 05:33:07
0001 <?php 0002 /** 0003 * ocs-webserver 0004 * 0005 * Copyright 2016 by pling GmbH. 0006 * 0007 * This file is part of ocs-webserver. 0008 * 0009 * This program is free software: you can redistribute it and/or modify 0010 * it under the terms of the GNU Affero General Public License as 0011 * published by the Free Software Foundation, either version 3 of the 0012 * License, or (at your option) any later version. 0013 * 0014 * This program is distributed in the hope that it will be useful, 0015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 * GNU Affero General Public License for more details. 0018 * 0019 * You should have received a copy of the GNU Affero General Public License 0020 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 **/ 0022 0023 // Define path to application directory 0024 defined('APPLICATION_PATH') 0025 || define('APPLICATION_PATH', realpath(dirname(__FILE__))); 0026 0027 0028 // Define application environment 0029 defined('APPLICATION_ENV') 0030 || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); 0031 0032 0033 // Ensure library/ is on include_path 0034 set_include_path(implode("/", array( 0035 APPLICATION_PATH . '/../../library', 0036 get_include_path(), 0037 ))); 0038 0039 0040 require_once 'Zend/Loader/Autoloader.php'; 0041 0042 $loader = Zend_Loader_Autoloader::getInstance(); 0043 $loader->setFallbackAutoloader(true); 0044 0045 echo "<pre>"; 0046 echo "start upload test picture\n"; 0047 0048 $client = new Zend_Http_Client('http://localhost/image_upload.php'); 0049 if (false === file_exists(APPLICATION_PATH . '/f5463b.png')) { 0050 echo "file not found."; 0051 exit(0); 0052 } 0053 $client->setFileUpload(APPLICATION_PATH . '/f5463b.png', 'f5463b.png', NULL, 'jpg'); 0054 //$client->setConfig(array('timeout' => 30)); 0055 //$client->setParameterPost('XDEBUG_SESSION_START', 'PHPSTORM'); 0056 //$client->setAuth('ubuntu', 'ubuntu.', Zend_Http_Client::AUTH_BASIC); 0057 0058 $response = $client->request('POST'); 0059 0060 echo $response->getBody()."\n"; 0061 //print_r($client->getLastRequest()); 0062 //print_r($client->getLastResponse()); 0063 echo "</pre>";