-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuploadExample.php
53 lines (39 loc) · 1.41 KB
/
uploadExample.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
session_start();
/*
$my_array=array('cat', 'dog', 'mouse', 'bird', 'crocodile', 'wombat', 'koala', 'kangaroo');
$_SESSION['animals']=$my_array;
echo 'Putting array into a session variable';
*/
// Uploadify v1.6.2
// Copyright (C) 2009 by Ronnie Garcia
// Co-developed by Travis Nickels
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
// Uncomment the following line if you want to make the directory if it doesn't exist
mkdir(str_replace('//','/',$targetPath), 0755, true);
move_uploaded_file($tempFile,$targetFile);
}
$str = $_FILES['Filedata']['name'];
$fp = fopen('upload.xml', 'a+');
//fwrite($fp, $str);fwrite($fp, "\n----\n");
//fclose($fp);
array_push($_SESSION['filenames'],$str);
array_push($_SESSION['animals'],$str);
foreach($_SESSION['filenames'] as $key=>$value)
{
// and print out the values
fwrite($fp, 'The value of $_SESSION['."'".$key."'".'] is '."'".$value."'".' <br />');
// echo 'The value of $_SESSION['."'".$key."'".'] is '."'".$value."'".' <br />';
}
foreach($_SESSION['animals'] as $key=>$value)
{
// and print out the values
fwrite($fp, 'The value of $_SESSION['."'".$key."'".'] is '."'".$value."'".' <br />');
// echo 'The value of $_SESSION['."'".$key."'".'] is '."'".$value."'".' <br />';
}
fclose($fp);
echo "1";
?>