mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
Moved under "trunk" to be able to track releases under "tags"
SVN:trunk[55]
This commit is contained in:
61
pages/php-ofc-library/ofc_upload_image.php
Normal file
61
pages/php-ofc-library/ofc_upload_image.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
//
|
||||
// In Open Flash Chart -> save_image debug mode, you
|
||||
// will see the 'echo' text in a new window.
|
||||
//
|
||||
|
||||
/*
|
||||
|
||||
print_r( $_GET );
|
||||
print_r( $_POST );
|
||||
print_r( $_FILES );
|
||||
|
||||
print_r( $GLOBALS );
|
||||
print_r( $GLOBALS["HTTP_RAW_POST_DATA"] );
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// default path for the image to be stored //
|
||||
$default_path = '../tmp-upload-images/';
|
||||
|
||||
if (!file_exists($default_path)) mkdir($default_path, 0777, true);
|
||||
|
||||
// full path to the saved image including filename //
|
||||
$destination = $default_path . basename( $_GET[ 'name' ] );
|
||||
|
||||
echo 'Saving your image to: '. $destination;
|
||||
|
||||
$jfh = fopen($destination, 'w') or die("can't open file");
|
||||
fwrite($jfh, $GLOBALS['HTTP_RAW_POST_DATA']);
|
||||
fclose($jfh);
|
||||
|
||||
//
|
||||
// LOOK:
|
||||
//
|
||||
exit();
|
||||
|
||||
|
||||
//
|
||||
// PHP5:
|
||||
//
|
||||
|
||||
|
||||
// default path for the image to be stored //
|
||||
$default_path = 'tmp-upload-images/';
|
||||
|
||||
if (!file_exists($default_path)) mkdir($default_path, 0777, true);
|
||||
|
||||
// full path to the saved image including filename //
|
||||
$destination = $default_path . basename( $_FILES[ 'Filedata' ][ 'name' ] );
|
||||
|
||||
// move the image into the specified directory //
|
||||
if (move_uploaded_file($_FILES[ 'Filedata' ][ 'tmp_name' ], $destination)) {
|
||||
echo "The file " . basename( $_FILES[ 'Filedata' ][ 'name' ] ) . " has been uploaded;";
|
||||
} else {
|
||||
echo "FILE UPLOAD FAILED";
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user