summaryrefslogtreecommitdiff
path: root/www/functions/func_upload.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/functions/func_upload.php')
-rwxr-xr-xwww/functions/func_upload.php25
1 files changed, 4 insertions, 21 deletions
diff --git a/www/functions/func_upload.php b/www/functions/func_upload.php
index 8059191..674b4cd 100755
--- a/www/functions/func_upload.php
+++ b/www/functions/func_upload.php
@@ -1,20 +1,5 @@
<?php
-/* This was tested with this interface, where PWD the primary key from the working directory is:
-
-UPDATE 26.3. : Should now accept the path as an argument.
-
-<!DOCTYPE html>
-<form method='post' action='/upload.php' enctype="multipart/form-data">
-<p>File :<input name="userfile" type="file" size="500000000" maxlength="100000000000000"></p>
-
-<p>PWD: <input type='text' name='path'></p>
-<p>Share: <input type='text' name='share'>
-<p><input type='submit' name='submit' value='upload'></p>
-</form>
-
-*/
-
function database_upload($db, $parentdir, $owner, $filename, $folder, $mime, $size, $share, $filehash){
if($db->exec("
BEGIN TRANSACTION;
@@ -27,7 +12,9 @@ function database_upload($db, $parentdir, $owner, $filename, $folder, $mime, $si
}
}
-function upload($db){
+function upload($path){
+
+ $db = $GLOBALS["db"];
if(!$_SESSION["login"]){
return UPLOAD_LOGIN;
@@ -37,11 +24,7 @@ function upload($db){
return UPLOAD_UPLOAD;
}
- $parentdir = select_file_id($db, $_SESSION["userid"], $_POST["path"]);
- //$parentdir = SQLite3::escapeString("$_POST[pwd]");
- if(!preg_match("/[0-9]+/", $parentdir)){
- return UPLOAD_PARENTFOLDER;
- }
+ $parentdir = select_file_id($db, $_SESSION["userid"], $path);
$folder_owner_db = $db->query("SELECT owner FROM files WHERE id=".$parentdir.";");
$folder_owner_ar = $folder_owner_db->fetchArray(SQLITE3_NUM);