Skip to content

Commit

Permalink
Bam, done with the app uploadings.
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangti committed Oct 3, 2012
1 parent f7b26d0 commit 428161d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions public/upload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

$post = $_POST;

$path = dirname(__DIR__);

foreach ($_FILES as $file) {

$source = $file['tmp_name'];
$targetFolder = $path . '/var/upload/' . $post['uniq'] . '/' . $file['name'];
mkdir(dirname($targetFolder), 0777, true);
copy($source, $targetFolder);
$post['dateAdded'] = time();

file_put_contents(dirname($targetFolder) . '/meta.json', json_encode($post));
}

?>

0 comments on commit 428161d

Please sign in to comment.