Certainly that is possible.
All you have to do is implement two parts:
- a simple API on the server side implemented in a single php script.
It accepts a file and stores it somewhere. Maybe you want to add
some security or plausibility checks, but that is another story.
- a small script on the client side that iterates the array and uploads
each file one by one using the API.
That's all, no form required and no manual upload of single objects.
As requested I add a short example. Nothing fancy, just to show the idea:
The server side API, a primitive php script called upload.php here:
<?php
// this is where uploaded files get dumped to
define('FILES_STORAGE','/some/path/writeable/for/http-server');
// $_FILES holds the meta data of the uploaded file as stored temporarily
syslog(LOG_DEBUG,sprintf("upload API accepted file '%s'",$_FILES['filedata']['name']));
// copy file to its final destination (temp file gets removed automatically)
copy ( $_FILES['filedata']['tmp_name'] , FILES_STORAGE.$_FILES['filedata']['name']);
// some feedback to the client, might be ignored
echo sprintf("file '%s' accepted and stored. ", $_FILES['filedata']['tmp_name']);
?>
The client side script, I made a trivial bash script, though you can use whatever language you want or have available on client side. It uploads only a singel file, but oviously this can be done in a loop processing a list of files or whatever:
#!/bin/bash
curl -i -F name=test -F [email protected] http://api.myserver.org/upload.php
When you execute the script the file gets uploaded and moved to the folder defined at the top of the API file as FILES_STORAGE. No error, security and plausibility checking is done, since this is a proof of concept.