El 21/08/12 21:00, Maarten Dammers escribió:
To focus on the filename
Op 21-8-2012 19:58, Brion Vibber schreef:
The final filename should be whatever we provide
to MediaWiki's upload
API; I can't think how it would come from Cordova. It looks like it's
being added by MediaWiki, actually -- we're sending a filename without
an extension.
08-21 10:56:30.784: D/FileTransfer(9443): fileName: Second and Howard
Streets District (taken on 21Aug2012 10hrs56mins22secs)
Perhaps adding a '.jpg' extension would eliminate the auto-added one?
The
filename should be clear and unique. Some things you can hash into
the filename:
* Name
* Username
* Date
* Monument id
* Timestamp taken
You want to trim name if it exceeds a certain length. Inluding the id
and the username makes sure that you'll only collide with yourself.
Timestamp in iso format is probably a bit cleaner (YYYY-MM-DD HH:mm).
Maarten
ISO format does seem clear. Date gives much uniqueness, but pollutes the
filename. I'd prefer if when uploading the filename, we could suggest a
pattern and mediawiki gave us a unique alternative filename if needed.
For instance sending:
action=upload&filename=St._Andrew's_Church.jpg&filenamepattern=St.
%20Andrew's%20Church_-_%25d.jpg&comment=...
and receiving:
{"upload":{"result":"Warning","warnings":{"exists":"St._Andrew's_Church.jpg"},"available":
"St._Andrew's_Church-5.jpg, "filekey":...}