Code: |
javascript:(function(){var e=document.createElement("input");e.type="file",e.onchange=function(){var t=new FormData;t.append("files[]",this.files[0]);var n=new XMLHttpRequest;n.open("POST","https://files.offshore.cat/api/upload",!0),n.setRequestHeader("x-api-key","CuDZ6qQzscE50ITu8HsH94IaQT05ieD7fOvRkUyAnh1BI6e6ujwWoTWKjLowB6MY"),n.onload=function(){if(200===n.status){console.log("File uploaded successfully!");var e=JSON.parse(n.responseText);alert("Uploaded file link: " + e.url)}else alert("An error occurred while uploading the file.")},n.onerror=function(){alert("An error occurred while uploading the file.")},n.send(t)},e.click()})(); |