This topic is locked

upload files year/month

4/8/2014 2:57:07 PM
PHPRunner General questions
W
wlodek author

Hi,
Poorly know English!
My table:

id

dateScan

file
How to upload files based on date field dateScan?
example: files/2007/08
Thanks for your help

admin 4/8/2014

Sure, this can be done.
Check example at http://xlinesoft.com/phprunner/docs/rename_uploaded_file.htm

Use PHP's rename() funcion to move your file to the new folder:

http://us3.php.net/rename

W
wlodek author 4/9/2014



Sure, this can be done.
Check example at http://xlinesoft.com/phprunner/docs/rename_uploaded_file.htm

Use PHP's rename() funcion to move your file to the new folder:

http://us3.php.net/rename


This topic has already read. I do not know how I do it.

admin 4/9/2014

If you do not know how to write this code consider hiring PHP programmer to do this for you. This task is relatively simple and doesn't require extensive PHPRunner knowledge.
An additional PHP code sample that creates this sort of folder named after current year and month:

http://techniqzone.blogspot.com/2013/08/create-folderdirectory-with-current.html

W
wlodek author 4/17/2014

udało mi się tak:



// get information about uploaded files

$fileArray = my_json_decode($values["file"]);



// rename files

for($i = 0; $i < count($fileArray); $i++)

{

$fileName = $fileArray[$i]["name"];



if (!file_exists("files/pkt/".$values["dateScan"]."/")) { mkdir("files/pkt/".$values["dateScan"]."/", 0777, true); }
$newFileName = "files/pkt/".$values["dateScan"]."/".$values["dateScan"].$i.".pdf";

rename($fileName, getabspath($newFileName));

$fileArray[$i]["name"] = $newFileName;

}



// update values of the field that stores file names

$values["file"] = my_json_encode($fileArray);


creates directories (files/pkt/Y-M-D), and I want to (files/pkt/Y/M)

and overwrites files such as (2007-05-050.pdf)



If you do not know how to write this code consider hiring PHP programmer to do this for you. This task is relatively simple and doesn't require extensive PHPRunner knowledge.


How much would it cost to write this function (code)?