9 Replies - 268 Views - Last Post: 13 May 2014 - 01:25 PM Rate Topic: -----

#1 PHPNewbie  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 10-May 14

File Sharing System

Posted 12 May 2014 - 07:06 AM

Hi so I'm learning PHP and PDO in school and been assigned to create a basic website with a register, login and upload page. The following step i have been assigned is to enable file sharing to members that want to share documents but i'm really confused as to how to go about doing this, i've looked at some tutorials but they dont cover much could someone guide me in the right direction please, this is for a school project only i dont care how spectacular it is as long as it does the basic file sharing

Is This A Good Question/Topic? 0
  • +

Replies To: File Sharing System

#2 astonecipher  Icon User is offline

  • D.I.C.
  • member icon

Reputation: 768
  • View blog
  • Posts: 3,358
  • Joined: 03-December 12

Re: File Sharing System

Posted 12 May 2014 - 07:37 AM

What is file sharing?

The ability to upload and download files.

How do you upload a file?

As a side not : At least you are learning PDO and not mysql_
Was This Post Helpful? 1
  • +
  • -

#3 PHPNewbie  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 10-May 14

Re: File Sharing System

Posted 12 May 2014 - 07:42 AM

View Postastonecipher, on 12 May 2014 - 07:37 AM, said:

What is file sharing?

The ability to upload and download files.

How do you upload a file?

As a side not : At least you are learning PDO and not mysql_


hi basically i have a server so the upload documents are stored there but obis i want to prevent users from looking at others files but also their ability to share with who they want. Basically we a re covering dropbox and systems similar to that in class but we haven't covered the code and i can't seem to find tutorials that cover what I need i dont just want the code i want to learn it too
Was This Post Helpful? 0
  • +
  • -

#4 astonecipher  Icon User is offline

  • D.I.C.
  • member icon

Reputation: 768
  • View blog
  • Posts: 3,358
  • Joined: 03-December 12

Re: File Sharing System

Posted 12 May 2014 - 07:51 AM

Figure out how you would want to restrict access. Make this a problem solving exercise. What to restrict and how.
Was This Post Helpful? 0
  • +
  • -

#5 PHPNewbie  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 10-May 14

Re: File Sharing System

Posted 12 May 2014 - 07:52 AM

View Postastonecipher, on 12 May 2014 - 07:51 AM, said:

Figure out how you would want to restrict access. Make this a problem solving exercise. What to restrict and how.


okay ill post in a while what I've done
Was This Post Helpful? 0
  • +
  • -

#6 PHPNewbie  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 10-May 14

Re: File Sharing System

Posted 13 May 2014 - 01:08 PM

hi okay so I've been reading up on file sharing etc so far i have a file upload working and file display with links however i want only the links to display of that particular user that has logged in and started a session. Will this feature be able to be added to this code or do i need to develop a new section?

<?php 
					function find_all_files($dir) 
					{ 
    					$root = scandir($dir); 
    					foreach($root as $value) 
    					{ 
    				    	if($value === '.' || $value === '..') {continue;} 
        				if(is_file("$dir/$value")) {$result[]="$dir/$value";
        				continue;
        				} 
        				foreach(find_all_files("$dir/$value") as $value) 
        				{ 
           				 $result[]=$value; 
       					 } 
   					 } 
  					  return $result; 
					} 
					$fileupload = 'fileupload';
					$getem = find_all_files($fileupload);
						foreach($getem as $key => $value){
						echo '<a href="'.$value.'">'.$value.'</a><br />';
						}
						?>


Was This Post Helpful? 0
  • +
  • -

#7 ArtificialSoldier  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 471
  • View blog
  • Posts: 1,729
  • Joined: 15-January 14

Re: File Sharing System

Posted 13 May 2014 - 01:11 PM

How do you record which files belong to a user, is that in a database?
Was This Post Helpful? 0
  • +
  • -

#8 PHPNewbie  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 10-May 14

Re: File Sharing System

Posted 13 May 2014 - 01:14 PM

View PostArtificialSoldier, on 13 May 2014 - 01:11 PM, said:

How do you record which files belong to a user, is that in a database?


yes i have 3 tables:

- login (users info)
- subfolder (users folders)
- files (uploaded files info)

they all connect to each other with a user id set
Was This Post Helpful? 0
  • +
  • -

#9 ArtificialSoldier  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 471
  • View blog
  • Posts: 1,729
  • Joined: 15-January 14

Re: File Sharing System

Posted 13 May 2014 - 01:24 PM

The code you have is just scanning a directory for files. I would replace that with a call to the database to get information about the user's files (and folders, if that table maps to actual hard drive folders), and then only show links for those instead of every file in the directory.
Was This Post Helpful? 0
  • +
  • -

#10 PHPNewbie  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 10-May 14

Re: File Sharing System

Posted 13 May 2014 - 01:25 PM

View PostArtificialSoldier, on 13 May 2014 - 01:24 PM, said:

The code you have is just scanning a directory for files. I would replace that with a call to the database to get information about the user's files (and folders, if that table maps to actual hard drive folders), and then only show links for those instead of every file in the directory.


thanks ill give that a try :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1