PHP Upload Download Hub - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

PHP Upload Download Hub

Description:

There is a method of transferring files that ... II. What is an Upload Download Hub? Allows your users to upload files to a given directory via a web browser ... – PowerPoint PPT presentation

Number of Views:78
Avg rating:3.0/5.0
Slides: 16
Provided by: josephap
Category:
Tags: php | browser | download | hub | is | upload | url | what

less

Transcript and Presenter's Notes

Title: PHP Upload Download Hub


1
PHP Upload Download Hub
  • A Group Project By
  • Renée Puchalski
  • Jonathan Xavier Ozovek

2
Presentation Outline
  • Introduction
  • Explanation What is an Upload Download Hub?
  • Testing the Script
  • How does this Script Work?
  • New Features
  • The Result
  • Conclusion

3
I. Introduction
  • The most common method of transferring files
    between two or more people are E-mail and FTP.
  • These methods of file sharing due to their
    disadvantages can become one big pain in the
    neck.
  • There is a method of transferring files that will
    both, save you time and allow for multiple people
    to store their files in one central location
    this method of file sharing can be achieved by
    using an Upload Download Hub.

4
II. What is an Upload Download Hub?
  • Allows your users to upload files to a given
    directory via a web browser
  • Creates a list of all files uploaded so that
    they can be downloaded
  • Features included file size limitation,
    extension limitation, and prevention of file
    overwriting

5
III. Testing the Script
  • In the same directory that we intended to upload
    the PHP Upload Download file, we created a
    directory called uploads with read, write, and
    execute permissions.
  • Changed the settings for our server paths in the
    Upload Download script
  • dl"http//www.cs.scranton.edu/rp6/web_prog/
    team_assign2/upDown/uploads/" //url where files
    are uploaded
  • absolute_path"/users/student/rp6/public_html
    /web_prog/team_assign2/upDown/uploads/"
    //Absolute path to where files are uploaded
  • Original Upload Download Hub in action

6
IV. How does this Script Work?
  • Original Upload Download Hub Script

7
V. New Features
  • IP Logger for Uploads
  • E-mail Integration
  • Dating of Uploaded Files
  • Allowing Multiple Versions of One File to be
    Uploaded
  • Security

8
i. IP Logger
  • Started by creating a text file named
    uploaded.txt, uploaded that to our servers, and
    gave permissions of read and write so the text
    files could be written to by an outside user.
    This file is also centralized on one directory
  • Now the PHP script
  • upload_log /xxxx/xxxx/uploaded.txt"
  • visit date("m/d/Y His")
  • ip getenv('REMOTE_ADDR')
  • size sizeof(file)
  • fp fopen("upload_log" , "a")
  • fputs(fp, " visit \t ip \t
    file_name \t size\n")
  • flock(fp, 2)
  • fclose(fp)

9
ii. E-mail Integration
  • Informs us when a file has been uploaded and by
    whom. File is also centralized and has
    read/write access to outside users.
  • Script that handles E-mail operation
  • emailFile /xxx/xxx/webUpload.txt"
  • OutHandle fopen (emailFile, "a")
  • fputs(OutHandle, name."\n")
  • fputs(OutHandle, file_name."\n")
  • fputs(OutHandle, descr."\n")
  • Body name."\n".file_name."\n".des
    cr
  • descr preg_replace("/\n/", "ltbrgt",
    descr)
  • fputs(OutHandle, descr."\n")
  • fclose (OutHandle)
  • Addl "From puchalskir2_at_scranton.edu
    \n"
  • ."Reply-To
    puchalskir2_at_scranton.edu"
  • mail ("puchalskir2_at_scranton.edu","Website
    Upload", Body, Addl)

10
iii. Dating of Uploaded Files
  • The date and time of when a file was uploaded is
    now displayed next to the file name in the
    download table. It is accomplished through
    saving upload dates and times through a text
    file, date.txt
  • This text file is shared by both mirror hubs,
    which means that uploads by either site will
    write to same shared text file.

11
iv. Allowing Multiple Versions of One File to be
Uploaded
  • Script checks for same file being uploaded. If
    yes, it will add the new version via a number at
    the end of the name string.
  • Here is the script for this new feature
  • v 0
  • if (file ! "")
  • if (file_exists("absolute_path/file_name"))
  • file_name2 "name"."_"."v"."_"."file_name"
  • while(file_exists("absolute_path/file_name2")
    )
  • file_name2 ""
  • v
  • file_name2 "name"."_"."v"."_"."file_name"
  • file_name "name"."_"."v"."_"."file_name"

12
v. Security Issues
  • Limited access to our file sharing hub with
    .htaccess UNIX server security.
  • The security link is consistent across both of
    our UNIX accounts.
  • We have different .htaccess files, but we share
    the password and group files on one account.
  • This security was achieved by changing the
    permissions of the directory of the group and
    password file to chmod 711.

13
VI. The Result
  • Upload_Download_Hub.phps
  • Upload_Download_Hub.php
  • Date text file
  • Upload text file
  • Email text file

14
VII. Conclusion
  • We have decided that the Upload Download Hub is
    the most efficient way to share files between two
    or more people. Hopefully, youve seen the
    benefits of such an implementation.
  • This method of file sharing would be very
    important to businesses today as it saves you
    time and aggravation, and everyone in the
    business world knows that time is money.

15
  • ANY QUESTIONS?
Write a Comment
User Comments (0)
About PowerShow.com