colonymech / docs / www / colonyscout / internal / uploadify / uploadify / upload_name.php @ f59acf11
History | View | Annotate | Download (732 Bytes)
1 |
<?php
|
---|---|
2 |
// JQuery File Upload Plugin v1.6.2 by RonnieSan - (C)2009 Ronnie Garcia
|
3 |
// Sample by Travis Nickels
|
4 |
|
5 |
if (!empty($_FILES)) { |
6 |
$tempFile = $_FILES['Filedata']['tmp_name']; |
7 |
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/'; |
8 |
$newFileName = $_GET['name'].'_'.(($_GET['location'] != '')?$_GET['location'].'_':'').$_FILES['Filedata']['name']; |
9 |
$targetFile = str_replace('//','/',$targetPath) . $newFileName; |
10 |
|
11 |
// Uncomment the following line if you want to make the directory if it doesn't exist
|
12 |
// mkdir(str_replace('//','/',$targetPath), 0755, true);
|
13 |
|
14 |
move_uploaded_file($tempFile,$targetFile); |
15 |
} |
16 |
|
17 |
if ($newFileName) |
18 |
echo $newFileName; |
19 |
else // Required to trigger onComplete function on Mac OSX |
20 |
echo '1'; |
21 |
|
22 |
?>
|