Browse Source

media upload

master
Robin Thoni 9 years ago
parent
commit
10eae4481f
2 changed files with 9 additions and 0 deletions
  1. 1
    0
      .gitignore
  2. 8
    0
      status.php

+ 1
- 0
.gitignore View File

@@ -1 +1,2 @@
1 1
 misc/config.php
2
+medias

+ 8
- 0
status.php View File

@@ -1,5 +1,6 @@
1 1
 <?php
2 2
 require_once "utils.php";
3
+require_once "misc/config.php";
3 4
 
4 5
 function check_token()
5 6
 {
@@ -24,6 +25,13 @@ function status_create()
24 25
   $lat = check_float(get_post("latitude", false));
25 26
   $long = check_float(get_post("longitude", false));
26 27
   $media = null;
28
+  if (isset($_FILES["media"])
29
+      && getimagesize($_FILES["media"]["tmp_name"]) !== false)
30
+  {
31
+    global $media_path;
32
+    $media = $media_path . dechex(time());
33
+    move_uploaded_file($_FILES["media"]["tmp_name"], $media);
34
+  }
27 35
 
28 36
   $u = database_exec("SELECT `id`, `username` FROM users WHERE `id` = ".
29 37
     "(SELECT `user` FROM tokens WHERE `token` = :token)",

Loading…
Cancel
Save