Loading...
 
Skip to main content

Features / Usability


Modified the picture upload so it creates timestamp in the filename

I have made some modifications to the image upload procedure so it creates a timestamp in the file name. This will make it so people dont have to worry about having the same picture name as someone else. Thus overwriting the original picture:

The modifications are easy - but I must admit I have not been able to test them much.

The output created in the wiki_up folder is as follows:

-rw-r--r-- 1 httpd httpd 403 Oct 29 12:01 1225299601SampleImage.png
-rw-r--r-- 1 httpd httpd 403 Oct 29 12:04 1225299850SampleImage.png
-rw-r--r-- 1 httpd httpd 403 Oct 29 12:09 1225300151SampleImage.png


I think this is a usefull feature, but not sure how to let devs know to include something similar.

templates/tiki-editpage.tpl
Added

Copy to clipboard
{php} $pretime = time(); {/php}

Modified (notice the hidden field "pretime") — I am having problems with this code showing up here - going to post a pic in a bit.

Image


/lib/tiki-js.js
Modified:
function insertImgFile

added

Copy to clipboard
pretime = getElementById("pretime");

Modified

Copy to clipboard
str = "{img src=\"img/wiki_up/" +filename + "\" }\n"; to str = "{img src=\"img/wiki_up/" + pretime.value +filename + "\" }\n";

tiki-editpage.php
Added a line

Copy to clipboard
$pretime = intval($_REQUEST['pretime']);

and modified line 356:
Changed:

Copy to clipboard
$picname = $_FILES['picfile'.$i]['name']; to $picname = $pretime.$_FILES['picfile'.$i]['name'];