mirror of
https://git.v0l.io/Kieran/void.cat.git
synced 2025-09-27 22:57:11 +02:00
support uploads > 4GB
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@ out/
|
||||
*.xml
|
||||
src/php/config.php
|
||||
google*.html
|
||||
bower_components/
|
@@ -3,9 +3,9 @@ CREATE TABLE `files` (
|
||||
`hash256` varchar(64) NOT NULL,
|
||||
`filename` varchar(255) NOT NULL,
|
||||
`mime` varchar(64) NOT NULL,
|
||||
`size` int(11) NOT NULL,
|
||||
`size` bigint(20) NOT NULL,
|
||||
`path` varchar(512) NOT NULL,
|
||||
`views` int(11) DEFAULT 0 NULL,
|
||||
`views` bigint(20) DEFAULT 0 NULL,
|
||||
`isAdminFile` bit(1) DEFAULT 0 NULL,
|
||||
`uploaded` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`lastview` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
@@ -2,6 +2,8 @@
|
||||
include_once('db.php');
|
||||
include_once("functions.php");
|
||||
|
||||
set_time_limit(1200);
|
||||
|
||||
$response = array(
|
||||
"status" => 0,
|
||||
"msg" => null,
|
||||
@@ -132,23 +134,23 @@
|
||||
hash_update($phc, $fh);
|
||||
$ph = hash_final($phc);
|
||||
$response["publichash"] = $ph;
|
||||
|
||||
//save to disk
|
||||
$op = _FILEPATH . $ph;
|
||||
$fo = fopen($op, 'wb+');
|
||||
if($fo !== False){
|
||||
stream_copy_to_stream($tmpf, $fo);
|
||||
fclose($fo);
|
||||
|
||||
//save to db
|
||||
$f_e = new FileUpload();
|
||||
$f_e->hash160 = $ph;
|
||||
$f_e->hash256 = $fh;
|
||||
$f_e->mime = $mime;
|
||||
$f_e->size = filesize($op);
|
||||
$f_e->size = $fsize;
|
||||
$f_e->path = $op;
|
||||
$f_e->filename = $fname;
|
||||
|
||||
$db->InsertFile($f_e);
|
||||
if($db->InsertFile($f_e)) {
|
||||
stream_copy_to_stream($tmpf, $fo);
|
||||
fclose($fo);
|
||||
$discord_data = array("content" => _SITEURL . '#' . $f_e->hash160);
|
||||
send_discord_msg($discord_data);
|
||||
|
||||
@@ -164,6 +166,10 @@
|
||||
$response["status"] = 500;
|
||||
$response["msg"] = "Server error!";
|
||||
}
|
||||
} else {
|
||||
$response["status"] = 500;
|
||||
$response["msg"] = "Server error!";
|
||||
}
|
||||
}
|
||||
//close streams
|
||||
fclose($tmpf);
|
||||
|
Reference in New Issue
Block a user