{"id":16754696,"url":"https://github.com/evilpie/senddata","last_synced_at":"2025-03-16T06:14:13.990Z","repository":{"id":137636099,"uuid":"808225","full_name":"evilpie/SendData","owner":"evilpie","description":null,"archived":false,"fork":false,"pushed_at":"2010-08-08T21:06:13.000Z","size":100,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-22T18:28:06.363Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evilpie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-07-30T20:09:56.000Z","updated_at":"2017-06-05T19:43:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"44245b1f-a4c2-41ef-bc2b-c00b28be2dfb","html_url":"https://github.com/evilpie/SendData","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilpie%2FSendData","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilpie%2FSendData/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilpie%2FSendData/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilpie%2FSendData/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evilpie","download_url":"https://codeload.github.com/evilpie/SendData/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830954,"owners_count":20354855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T03:05:39.128Z","updated_at":"2025-03-16T06:14:13.969Z","avatar_url":"https://github.com/evilpie.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"SendData\n========\n\nSendData is an Class modleded after FormData to make this functionallity aviable in FireFox 3.5.\nThe main usefull part is sending files, this feature requires the FileReader.\n\nExample\n------\n\n     var xhr, sd, fd;\n     \n     xhr = new XMLHttpRequest;\n     xhr.open('POST', '/upload.php', true) // You need to use post requests\n     \n     if ('FormData' in window) { // use native FormData if possible\n       fd = new FormData(); \n       fd.append('foo', 'bar');\n       fd.append('answere', 42);\n       fd.append('file', document.getElementById('input_file').files[0]); // \u003cinput type=\"file\"\u003e\n       \n       xhr.send(fd);\n     }\n     else {\n       sd = new SendData();\n       sd.append('foo', 'bar');\n       sd.append('answere', 42);\n       sd.append('file', document.getElementById('input_file').files[0]);\n       \n       sd.send(xhr) // Attention!\n     }\n\n\nRemarkes\n-------\nSendData internally sets three Request Headers: \"Content-Type\", \"Connection\" and \"Content-Length\"\n\n\nMethods\n-------\n\nSendData#append(name, value)\n\nname: the name of the field, its basically the same as for example the name of an input field\nvalue: can be anything, but File Objects get special treatment\n\nSendData#send(XMLHttpRequestInstance)\n\nXMLHttpRequestInstance: Where the data should be written to\n\n\nProperties\n----------\n\nSendData#onerror = function (message) { }\n\nAssign your handler to this, if you want to get messages when reading a file fails.\n\nStatic Method\n-------------\n\nSendData.fromForm(form)\n\nform: a html form element\n\nThis function is similiar to Mozillas Form#getFormData, and will return a new SendData instance.\n\n\nExclaimer\n--------\nThis is my first javascript class i ever wrote, to i would be really happy to get some feedback.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilpie%2Fsenddata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevilpie%2Fsenddata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilpie%2Fsenddata/lists"}