Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/198407-file-manager-help/
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/198407-file-manager-help/#findComment-1041138
Share on other sites

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";
}

Link to comment
https://forums.phpfreaks.com/topic/198407-file-manager-help/#findComment-1041162
Share on other sites

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-

 

Link to comment
https://forums.phpfreaks.com/topic/198407-file-manager-help/#findComment-1041407
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/198407-file-manager-help/#findComment-1041756
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/198407-file-manager-help/#findComment-1042708
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.