Roddy87 Posted April 13, 2010 Share Posted April 13, 2010 Hi i have been working on a file manager system where users can login and upload files and download files from other users. My problem now after gettin that part to work is that i now would like to add an option, so that when a user is uploading, to choose to show or hide the file from the file list from other users, but would default as hidden if nothing is chosen. Can anyone help me in anyway? Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/198407-file-manager-help/ Share on other sites More sharing options...
andrewgauger Posted April 13, 2010 Share Posted April 13, 2010 That is really easy. Create a checkbox on the upload page "[] public" that will default to unchecked create an entry in the MySQL database "ALTER TABLE tbl_name ADD public bool" modify your php to capture the $_POST['public'] modify the INSERT to include the public that you capture from the POST. You are using a MySQL database to track the files right? Quote Link to comment https://forums.phpfreaks.com/topic/198407-file-manager-help/#findComment-1041138 Share on other sites More sharing options...
Roddy87 Posted April 13, 2010 Author Share Posted April 13, 2010 if ($grants[$user_status][uPLOAD]) { echo " <br>"; echo " <script language=\"JavaScript\" type=\"text/javascript\" src=\"hide.js\"></script>"; echo " <table border=\"0\" width=\"90%\" bgcolor=\"#000000\" cellpadding=\"4\" cellspacing=\"1\">\n"; echo " <tr>\n"; echo " <th align=\"left\" valign=\"middle\"></th>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\" bgcolor=\"#FFFFF\" valign=\"middle\">\n"; echo " <form name=\"upload\" action=\"index.$php?".SID."\" enctype=\"multipart/form-data\" method=\"post\" style=\"margin: 0\">\n"; echo " <input type=\"hidden\" name=\"action\" value=\"upload\">\n"; echo " <input type=\"hidden\" name=\"directory\" value=\"$directory\">\n"; echo " <input type=\"hidden\" name=\"order\" value=\"$order\">\n"; echo " <input type=\"hidden\" name=\"direction\" value=\"$direction\">\n"; echo " <table border=\"0\" width=\"100%\" cellpadding=\"4\">\n"; echo " <tr id=\"progress\" style=\"display:none; text-align:center;\"><td colspan=\"2\"><img src=\"images/processing.gif\" alt=\"processing\"></td></tr>\n"; echo " <tr>\n"; echo " <td align=\"left\" width=\"15%\"></td>\n"; echo " <td align=\"left\" width=\"90%\" colspan=\"2\">\n"; echo " <input type=\"file\" class=\"vform\" name=\"userfile\" size=\"50\" />\n"; echo " </td>\n"; echo " </tr>\n"; echo " <tr> \n"; echo " <td align=\"left\" width=\"15%\"></td>\n"; echo " <td align=\"left\" width=\"70%\">\n"; echo " <input type=\"text\" name=\"description\" class=\"vform\" size=62>\n"; echo " </td>\n"; echo " <td align=\"right\" width=\"15%\">\n"; echo " <input type=\"submit\" class=\"vform2\" value=\"\" onClick=\"Hide('progress');\">\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </form>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; } Quote Link to comment https://forums.phpfreaks.com/topic/198407-file-manager-help/#findComment-1041162 Share on other sites More sharing options...
Roddy87 Posted April 13, 2010 Author Share Posted April 13, 2010 So in short no i wasnt using mysql...is there another way or do i have to use the mysql? Quote Link to comment https://forums.phpfreaks.com/topic/198407-file-manager-help/#findComment-1041163 Share on other sites More sharing options...
Roddy87 Posted April 13, 2010 Author Share Posted April 13, 2010 I used some code that i saw on another forum about a file manager called phpATM... Quote Link to comment https://forums.phpfreaks.com/topic/198407-file-manager-help/#findComment-1041170 Share on other sites More sharing options...
Roddy87 Posted April 14, 2010 Author Share Posted April 14, 2010 can anyone help me with a work around? i am still learning Quote Link to comment https://forums.phpfreaks.com/topic/198407-file-manager-help/#findComment-1041402 Share on other sites More sharing options...
ChemicalBliss Posted April 14, 2010 Share Posted April 14, 2010 It would help if we knew your current implementation. Database type. flat file? mysql? odbc? How does your script work at the moment? Specifically, is the upload form in two files (one form, one processor), code of both ends would help too. Adding this functionality to the system you have already mentioned should be relatively simple depending on the complexity/messiness of the code. -cb- Quote Link to comment https://forums.phpfreaks.com/topic/198407-file-manager-help/#findComment-1041407 Share on other sites More sharing options...
andrewgauger Posted April 14, 2010 Share Posted April 14, 2010 phpATM... Never heard of it. Sorry Quote Link to comment https://forums.phpfreaks.com/topic/198407-file-manager-help/#findComment-1041423 Share on other sites More sharing options...
andrewgauger Posted April 14, 2010 Share Posted April 14, 2010 So I've been looking at the implementation of phpATM and it looks like it creates a file named the username in the directory $users_folder_name (checkout the include/functions.php file) The file format is: username - name of the file, the following are line by line: password (encrypted) session (encrypted) email Status (admin=0, power=1, normal=2) Active? (0 for disabled >1 for account activation) temp digest? timestamp (created) The files, however, are not tracked. They determine if a file is available by getting the contents of a directory. So other than creating a private directory this is not the ideal solution for your proposal. Implementing a directory for every user (using their user name as the directory name) would work well for a private directory. You are going to have to implement another add_file function for private directories, but you won't have to modify the get_files because these files will not by default be publicly viewable. Proposed time to implement exceeds a man week though. Quote Link to comment https://forums.phpfreaks.com/topic/198407-file-manager-help/#findComment-1041756 Share on other sites More sharing options...
Roddy87 Posted April 15, 2010 Author Share Posted April 15, 2010 So I've been looking at the implementation of phpATM and it looks like it creates a file named the username in the directory $users_folder_name (checkout the include/functions.php file) The file format is: username - name of the file, the following are line by line: password (encrypted) session (encrypted) email Status (admin=0, power=1, normal=2) Active? (0 for disabled >1 for account activation) temp digest? timestamp (created) The files, however, are not tracked. They determine if a file is available by getting the contents of a directory. So other than creating a private directory this is not the ideal solution for your proposal. Implementing a directory for every user (using their user name as the directory name) would work well for a private directory. You are going to have to implement another add_file function for private directories, but you won't have to modify the get_files because these files will not by default be publicly viewable. Proposed time to implement exceeds a man week though. Ok thank you very much for the speedy reply it really helped alot...wat i have decided to do now is to kinda of have pub/priv files in that right now the uploads go to the main page and are viewable by all....so now i have decided to try to get users to upload to a page which will their personal page which will list their files and i added a checkbox (Make Public [ ]) and will try to do something like...if checkbox = checked....then send submitted data to main page....that way it will be kind of like public page n private page. Does this sound workable to you? Thanks alot again man your a big help Quote Link to comment https://forums.phpfreaks.com/topic/198407-file-manager-help/#findComment-1042708 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.