Git Product home page Git Product logo

fileshare-flask's Introduction

fileshare-flask

A simple file sharing program based on HTTP using flask

Setting up

  • Edit main.py, at bottom of the file, replace serve()'s arguments with your own IP/Port (use WSGI if need access outside of LAN; See here for more details)
  • Make sure you have installed flask, colorama, magic (if not install using "pip install flask colorama python-magic-bin") linux user install magic by "pip install python-magic"
  • Then run the python file main.py

Changing file sharing directory

  • Under ./static/ftpFiles/ is where the shared file will be stored by default
  • to change the file store location: Edit main.py look for serve() function and replace the optional argument "ftpDir" to your desire (This location must be under "./static/")

Troubleshooting

  • The requested address is not valid in its context. is caused by using an address that is not assigned to your network, check your current binding address is correct and try again
  • Not able to access from other devices? check if your firewall is blocking any inbound/outbound requests. if you are not able to access from an external network, check if you set up your WSGI server correctly
  • ImportError: failed to find libmagic. Check your installation is caused by incomplete python-magic installation, do "pip install libmagic FFMPEG" and try again, if problem persists try to download .whl file from here select the platform you needed and install. (Detailed install instructions can be found here)

API

  • send POST request to the path you want to list. If the path exists the remote will return a JSON contains
    {"FILENAME": ["FileURLPath", IsTheFileADirectory]} FILENAME and FileURLPath is string and IsTheFileADirectory is a boolean
  • send POST request to /ShowFileDetail with JSON that contains {"FILENAME": "", "PATH": ""}. The server will return JSON that contains a list of file properties if the file exists.
    JSON response example:
    {
    "file_name": "Helloworld.py",
    "file_ext": ".py",
    "file_path": "/pythonfiles/",
    "last_mod": Wed Dec 26 18:10:00 2018',
    "created": Wed Dec 26 18:06:00 2018',
    "file_size": 50492,
    "file_content_type": "Python Script",
    "full_detail": "Python script, ASCII text executable, with CRLF line terminators",
    "location": "/pythonfiles/Helloworld.py"
    }
    file_size: in bytes, last_mod and created date may not be accurate
TODO
  • Add ability to upload file
  • Code cleanup/Refactor
  • Add comments
  • Add file listing API
  • Add ability to view file details

UI Preview

UIPreviewMainSmall UIPreviewFileDetailsSmall

fileshare-flask's People

Contributors

sqz269 avatar fhfirdausi avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.