GET /ctdl/s/ Static content (html, css, js, images...)
GET /.well-known/ Static content (RFC5785 compliant paths)
POST /ctdl/p Handler for uploading attachments and other file items
+ The JSON returned wil contain one or more uploads in an array like this:
+ [
+ {
+ "uploadfilename" : "Track 01.wav",
+ "contenttype" : "audio/wav",
+ "ref" : "cdarzowkk",
+ "contentlength" : 56222252
+ }
+ ]
GET /ctdl/p/<id> Fetch a specific item that was uploaded
DELETE /ctdl/p/<id> Delete a specific item that was uploaded
void *content, char *cbtype, char *cbcharset,
size_t length, char *encoding, char *cbid, void *userdata)
{
- syslog(LOG_DEBUG, "upload_handler()");
- syslog(LOG_DEBUG, " name: %s", name);
- syslog(LOG_DEBUG, " filename: %s", filename);
- syslog(LOG_DEBUG, " part number: %s", partnum);
- syslog(LOG_DEBUG, " disposition: %s", disp);
- syslog(LOG_DEBUG, "content type: %s", cbtype);
- syslog(LOG_DEBUG, " char set: %s", cbcharset);
- syslog(LOG_DEBUG, " length: %ld", length);
- syslog(LOG_DEBUG, " encoding: %s", encoding);
- syslog(LOG_DEBUG, " id: %s", cbid);
- //fprintf(stderr, "\033[31m--------------------------------------------\n");
- //write(content, length, 1, stderr); // FIXME
- //printf(stderr, "--------------------------------------------\033[0m\n");
-
struct uploaded_file u;
// create a random ID for the attachment
for (int i=0; i<array_len(upload_list); ++i) {
memcpy(&u, array_get_element_at(upload_list, i), sizeof(struct uploaded_file));
- syslog(LOG_DEBUG, "%d: %s %s", i, u.id, u.filename);
}
// Create a JSON object describing this upload
h->response_string = strdup("OK");
h->response_body_length = StrLength(sj);
h->response_body = SmashStrBuf(&sj);
+ syslog(LOG_DEBUG, "upload: %s", h->response_body);
}