/filesend

Primary LanguagePHP

README

File upload demo with authentication. See screenshots here.

Setup

  1. Modify src/config/db.php based on your DB settings
  2. Run Apache and MySQL Server
  3. Create tables using the following queries
CREATE TABLE Users (
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    email VARCHAR(50) NOT NULL UNIQUE,
    password VARCHAR(255) NOT NULL
);

CREATE TABLE Files (
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    userid INT NOT NULL,
    file_name VARCHAR(50) NOT NULL,
    file_size VARCHAR(255) NOT NULL,
    uploaded_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    CONSTRAINT fk_userid
       FOREIGN KEY (userid)
       REFERENCES Users(id)
       ON DELETE CASCADE,
    UNIQUE (userid, file_name)
);

Assumptions

  • An email can only be used for registration once.
  • Assume unique file names under the same user directory.

Tools and Components

  • MAMP
  • Apache/2.4.43
  • PHP/7.4.2
  • MySQL/5.7.26

References