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
 misc/config.php
1
 misc/config.php
2
+medias

+ 8
- 0
status.php View File

1
 <?php
1
 <?php
2
 require_once "utils.php";
2
 require_once "utils.php";
3
+require_once "misc/config.php";
3
 
4
 
4
 function check_token()
5
 function check_token()
5
 {
6
 {
24
   $lat = check_float(get_post("latitude", false));
25
   $lat = check_float(get_post("latitude", false));
25
   $long = check_float(get_post("longitude", false));
26
   $long = check_float(get_post("longitude", false));
26
   $media = null;
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
   $u = database_exec("SELECT `id`, `username` FROM users WHERE `id` = ".
36
   $u = database_exec("SELECT `id`, `username` FROM users WHERE `id` = ".
29
     "(SELECT `user` FROM tokens WHERE `token` = :token)",
37
     "(SELECT `user` FROM tokens WHERE `token` = :token)",

Loading…
Cancel
Save