Skip to content

Instantly share code, notes, and snippets.

View DenoGeek's full-sized avatar

Dennis Kariuki DenoGeek

View GitHub Profile
@DenoGeek
DenoGeek / resumablediv.html
Last active January 11, 2020 09:39
Resumable js div
<style type="text/css">
.resume-upload{
width: 60%;
height: 200px;
background: skyblue;
margin: 40 auto;
border: 1px dashed black;
}
</style>
@DenoGeek
DenoGeek / resumable.html
Created January 11, 2020 09:42
Resumable js configuration
<script src="resumable.js"></script>
<script>
var r = new Resumable({
target:'http://localhost:8080/upload',
});
r.assignBrowse(document.getElementById('upload-area'));
// Resumable.js isn't supported, fall back on a different method
if(!r.support) location.href = '/some-old-crappy-uploader';
// ResumableUpload handles reumable uploads
func ResumableUpload(w http.ResponseWriter, r *http.Request) {
tempFolder := "/path/to/uploads/temp/"
switch r.Method {
case "GET":
resumableIdentifier, _ := r.URL.Query()["resumableIdentifier"]
resumableChunkNumber, _ := r.URL.Query()["resumableChunkNumber"]
path := fmt.Sprintf("%s%s", tempFolder, resumableIdentifier[0])
@DenoGeek
DenoGeek / combine.go
Created January 11, 2020 10:13
Recombine file chunks
chunkSizeInBytes := 1048576
chunksDir := "/path/to/uploads/temp/3203610240-WildifeTactics"
/*
Generate an empty file
*/
f, err := os.Create("testfile.mp4")
if err != nil {
fmt.Printf("Error: %s", err)
}