I need to make a web server (application) which will let user to upload some files, process them somehow (run a script) and return result as http document and optionally let user download a file. This is for private intranet (no serious security needed) and low volume of requests. The OS should be Linux. Does some framework exist for such applications?
Alfresco lets you do this.
It is a document management server, so you can upload files via the web interface, or via WebDAV/FTP/CMIS/etc.
A folder in Alfresco can have rules.
A rule has a condition and a procedure. Example:
- Condition: Any file that arrives in this folder
- Create a backup of the original in the "archive" folder
- Convert the file to PDF and to HTML
- Move it to the "output" folder
- Send an email notification to the file's owner
People can download anything from Alfresco if they have the correct login/password and permissions.
Alfresco rule configuration:
Free and open source.
I use CubicleSoft Admin Pack for creating admin interfaces and internal software such as Intranets all the time. Not too long ago, I added a multiple file uploader widget to FlexForms Modules, which could be useful for your needs.
Admin Pack my go-to tool of choice for building web backends since it is written in PHP and therefore runs on a standard LAMP/WAMP stack. PHP is an excellent server-side scripting language. Admin Pack is just a framework (of sorts) that does require writing software, but I've found that custom-built software solutions are usually better than prepackaged software when it comes to streamlining business processes because you get only what you need.
What most people don't realize is that PHP is also a fantastic command-line scripting language. If you have a long-running process or need to run a process as a user other than the web server user (e.g. 'root'), there are two routes that you can take to run a command-line PHP script:
A cron job that runs periodically (e.g. every minute), where the script looks at a specific directory for new files, processes them, and then stops running when it runs out of files to process. This is the classic quick-n-dirty solution.
Trigger a script to run via Cloud Storage Server /scripts. This is much more efficient since processing is triggered to start only when there is something to do. However, this solution takes more effort to set up and also blurs the web vs. system security line a bit.
Your web app drops uploaded files in a folder, the processing script picks them up and processes them, and processed files are dropped into an output folder, which the web app can show to the user. Periodic, automated cleanup of both folders should also take place. This sort of workflow is all fairly standard fare.
Standard Apache + PHP offers certain security and process isolation metrics that you won't find in other tools that emit a dynamic web server interface. When it comes to open ports in network infrastructure, even internally, the fewer the better. Also, system security should be the first priority in selecting a piece of software as many successful attacks against infrastructure start by exploiting internal actors (e.g. convincing an employee they should run some piece of software not caught by malware filters).
For a quick-n-dirty solution from a pure security standpoint, I'd stick with a package managed LAMP stack and fill in the long-running process bits with command-line PHP scripting.
If you are familiar with Java, I recommend the Vaadin Framework for developing your user-interface and application server.
Vaadin includes an upload widget. Your server-side Java app can then manipulate that uploaded file, output some other file, and offer that new file for download.
With Vaadin 8.1, the Vaadin team is working on advanced support for new HTML5 drag-and-drop protocols being defined by the web standards community. This should result in smoother interaction for dragging files from the user's computer's file system into the web browser and your Vaadin app. See the Drag-and-Drop chapter of Vaadin documentation.