Scenario
The company I work for has recently exploded (I started only a couple years after it started up) and we now have a second developer and about 5 more designers.
Previously, I worked on everything myself that was dev, including a showcase web-page that would hold banner ads to send to client – example here.
I developed my own templating system for this which just replaced tokens in a template such as {300x250} with a banner picked up from a directory specified in the row which represents this job that had a matching size.
The process for setting up one of these was:
- Connect to FTP and upload the files (swfs) into a given directory.
- Log into phpMyAdmin and create a record in a table which would hold information about the path to the files, client name and which template to use.
- Create a new template if required – ie if there’s an unusual assortment of banners.
As you can see, the above is almost impossible for someone without my skill-set to accomplish (ie, the designers).
My idea
What I want to do is create a template that will be hosted at our staging domain, and a companion index page that will search for a value via $_GET which will represent a path to a HTML file. For example:
http://example.com/?view=bing_lee_october.html
What I then want to do is create an interface that will do the following:
- Display a file-upload field that accepts a HTML file.
- When the HTML file has been selected, the document should be scanned to generate a list of all the SWF files that have been embedded on the page – this would most likely be done via
Insert -> Media -> SWFusing the Dreamweaver interface (by the designers). - Based on this list, the system should then automatically grab each of the SWF files and upload them along with the HTML file. I’m happy with everything being in the same directory for the sake of simplicity.
- Rename the SWF to whatever they were + unique id to avoid overriding.
- Replace the links to the SWF files in the HTML to match the renamed files.
- Generate a link to the newly created presentation desk – this will probably be made unique via PHP’s
uniqid()just to stop confusion, etc.
The result should be a link like this:
http://example.com/?view=4h78hg5d
Linking to SWFs like this:
- BLD020_November_300x250-4h78hg5d.swf
- BLD020_November_728x90-4h78hg5d.swf
- BLD020_November_160x600-4h78hg5d.swf
With my previously created template wrapping the HTML they uploaded.
My question
Is it possible to automatically add the companion SWF files to the upload queue, or is this only allowed manually?
If the latter, what’s another approach I can take to achieve the above?
Could your app accept a zip archive as an upload and then extract all of the files it needs that way?
Here’s an example from http://php.net/zip.examples#example-819 that opens a zip archive, outputs metadata about the archive and lists all of the files: