Wednesday, 15 April 2015

php - File Upload Plugin located in webroot ignores dynamic changes to the destination folder -



php - File Upload Plugin located in webroot ignores dynamic changes to the destination folder -

what have:

i using uploadify upload files intranet application im writing.

i need upload files directory belongs 1 user (with dynamic creation of directories).

my wrong solution :)

after user logs in create him folder(title user_id).

now uploadify.php looks this:

session_name("test_tool_cookie"); session_start(); $targetfolder = '/test_tool/app/webroot/uploadify/' . $_session['auth']['user']['user_id']; //relative root //the 3 lines above alter script //$targetfolder = '/test_tool/app/webroot/uploadify/tmpfile'; //this here before changes if (!empty($_files)) { $tempfile = $_files['filedata']['tmp_name']; $targetpath = $_server['document_root'] . $targetfolder; $targetfile = rtrim($targetpath,'/') . '/' . $_files['filedata']['name']; // validate file type $filetypes = array('html' , 'docx', 'pdf', 'xls', 'xlsx', 'txt'); // file extensions $fileparts = pathinfo($_files['filedata']['name']); if (in_array($fileparts['extension'],$filetypes)) { move_uploaded_file($tempfile,$targetfile); echo '1'; } else { echo 'invalid file type.'; } }

the problem

the above script won't upload file folder (checked , wont upload file anywhere else either).

if alter $targetfile static value, works fine.

the session value right (but ignored)

what else might earn answered question

i mark question reply if suggest multiupload plugin (with brief description) easy integrate cake php, , customizable, every object in database can have it's own folder.

please think answer, solution problem help lot.

did seek send session name form info on illustration here?

php session cakephp uploadify

No comments:

Post a Comment