tilemill-project / tilemill

TileMill is a modern map design studio
https://tilemill-project.github.io/tilemill/
BSD 3-Clause "New" or "Revised" License
3.11k stars 527 forks source link

validate uploads before sending data #1426

Open springmeyer opened 12 years ago

springmeyer commented 12 years ago

In the case of an upload error from hosting of "No storage space remaining" it would be great to trigger this before the upload wait.

willwhite commented 12 years ago

This is going to be bit of a chicken and egg problem since we don't validate the filesize until the map is created and we can't create the map until the upload is complete.

springmeyer commented 12 years ago

maybe a workaround would be to report the storage remaining somewhere on the export page, so a user could get a rough sense - say that they have 100 MB remaining but their export is 3 GB. Though I guess then a sync vs new upload would need to be taken into account (#1394)

springmeyer commented 11 years ago

@willwhite - has anything changed here? This would be really great to fix: https://twitter.com/zeke/status/280419877364310016 /cc @zeke

springmeyer commented 11 years ago

@willwhite - what about TileMill doing a file stat before uploading (but after export) and sending a initial check to hosting to see if it will fit?

willwhite commented 11 years ago

Yep I've thought a bit about this. Upload credentials could be issued with an oauth request like:

https://tiles.mapbox.com/api/Upload/:account?access_token=:token

We could add something like:

https://tiles.mapbox.com/api/Upload/:account?access_token=:token&filesize=:size&id=:mapid

Where :size is the file's size in bytes. If the file won't fit, an error will be returned instead of credentials. The :mapid can be used for replacing existing maps, where the size of the exiting map needs to be removed from the total.

Would that work?

springmeyer commented 11 years ago

Sounds promising. Ideally if the file will not fit the export could be kept around so the user can try uploading it again. To make this easier we might want to consider making an "upload" appear as both an mbtiles export plus a separate upload export.

zeke commented 11 years ago

Thanks for the CC. Let me know if I can help by building TileMill and trying out the feature!