danlew Posted January 16, 2009 Share Posted January 16, 2009 I am using php/mysql/apache linux server hosting for my site and testing the site on firefox 3.0+ I am creating a travel blog so I want to give my users a facility to uploaded images. I let them upload all images in a single folder "spaw2/uploads/images" and giving names of the files little dynamically using following code in spawfm.class.php spawfm.class.php (line no 514) I change from if (!@move_uploaded_file($uplfile['tmp_name'], $this->getCurrentFsDir().$uplfile_name)) { to $uplfile_name = $_SESSION['user_id_session']."-".$uplfile['name']; // i added this line if (!@move_uploaded_file($uplfile['tmp_name'], $this->getCurrentFsDir().$uplfile_name)) { where $_SESSION['user_id_session'] is the unique ID of a "loggedin user" who is uploading the file. so this way I upload images. for example if a user's unique ID is "007" then his uploaded files names will be like > 007-myfirstimage.jpg 007-mysecondimage.jpg 007-mysecondimage_1.jpg and so on.. it works fine till now . oh yes, and to make it successful i place session_start(); in the few php files to get value of $_SESSION variables. well this is not my problem. my problem now is I want to show a user only his own uploaded images in "SPAW file manager 's file list" I used a dirty trick in line no 276 in spawfm.class.php where I converted from > foreach ($directories as $key=>$file) { $directories[$key] = array( 'name' => $file, 'date' => $this->getFileDate($file), 'size' => $this->getFileSize($file), 'descr' => $lang->m('file_folder', 'file_details'), 'icon' => '../plugins/spawfm/img/'.$config->getConfigValueElement('PG_SPAWFM_FILETYPES_ICON_FOLDER', 'icon'), 'icon_big' => '../plugins/spawfm/img/'.$config->getConfigValueElement('PG_SPAWFM_FILETYPES_ICON_FOLDER', 'icon_big'), 'thumb' => $this->getFileThumbnail($file), 'other' => '' ); } to > foreach ($directories as $key=>$file) { $bravo_target=$_SESSION['user_id_session']."-"; // i added this line $bravo_img=substr($file,0,strlen($bravo_target)); // i added this line if($bravo_img==$bravo_target){ // i added this line $directories[$key] = array( 'name' => $file, 'date' => $this->getFileDate($file), 'size' => $this->getFileSize($file), 'descr' => $lang->m('file_folder', 'file_details'), 'icon' => '../plugins/spawfm/img/'.$config->getConfigValueElement('PG_SPAWFM_FILETYPES_ICON_FOLDER', 'icon'), 'icon_big' => '../plugins/spawfm/img/'.$config->getConfigValueElement('PG_SPAWFM_FILETYPES_ICON_FOLDER', 'icon_big'), 'thumb' => $this->getFileThumbnail($file), 'other' => '' ); } // i added this line } but strange .. its still showing all images resided in "images" folder where as I only want to show list of the files which are only his own uploaded by a user. Quote Link to comment https://forums.phpfreaks.com/topic/141052-spaw2-wysiwyg-help-show-specific-images-in-file-manager/ Share on other sites More sharing options...
danlew Posted January 19, 2009 Author Share Posted January 19, 2009 Any Ideas anyone? Quote Link to comment https://forums.phpfreaks.com/topic/141052-spaw2-wysiwyg-help-show-specific-images-in-file-manager/#findComment-740214 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.