From 6f540ad27eefae4eb959a83fc80040d2615c1db9 Mon Sep 17 00:00:00 2001 From: Christian Haschek Date: Tue, 8 Mar 2022 22:23:57 +0100 Subject: [PATCH] added copy url button closes #112 --- api/upload.php | 2 +- inc/core.php | 11 +++++++---- js/pictshare.js | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/api/upload.php b/api/upload.php index 8700057..3bd7195 100644 --- a/api/upload.php +++ b/api/upload.php @@ -1,7 +1,7 @@ buffer(file_get_contents($url, false, null, -1, 1024)); + //for windows we'll use mime_content_type. Make sure you have enabled the "exif" extension in php.ini + $type = mime_content_type($url); } if(!$type) return false; if(startsWith($type,'text')) return 'text'; @@ -431,7 +431,10 @@ function getUserIP() // checks the list of uploaded files for this hash function sha1Exists($sha1) { - $handle = fopen(ROOT.DS.'data'.DS.'sha1.csv', "r"); + $shafile = ROOT.DS.'data'.DS.'sha1.csv'; + + if(!file_exists($shafile)) touch($shafile); + $handle = fopen($shafile, "r"); if ($handle) { while (($line = fgets($handle)) !== false) { if(substr($line,0,40)===$sha1) return trim(substr($line,41)); diff --git a/js/pictshare.js b/js/pictshare.js index e255753..115b9c9 100644 --- a/js/pictshare.js +++ b/js/pictshare.js @@ -14,7 +14,7 @@ $(function() { { var o = JSON.parse(response); if(o.status=='ok') - $("#uploadinfo").append("") + $("#uploadinfo").append("") else if(o.status=='err') $("#uploadinfo").append("") console.log(o)