some documentation fixes
This commit is contained in:
@@ -33,7 +33,8 @@ var UploadProgressBar = /** @class */ (function () {
|
|||||||
UploadProgressBar.prototype.onFailure = function (response, error) {
|
UploadProgressBar.prototype.onFailure = function (response, error) {
|
||||||
this.uploadDiv.setAttribute('style', 'background: #821C40');
|
this.uploadDiv.setAttribute('style', 'background: #821C40');
|
||||||
this.uploadDivJQ.html(this.file.name + '<br/>'
|
this.uploadDivJQ.html(this.file.name + '<br/>'
|
||||||
+ 'Upload failed after three tries!');
|
+ 'Upload failed after three tries!<br/>'
|
||||||
|
+ "Message: " + error);
|
||||||
};
|
};
|
||||||
return UploadProgressBar;
|
return UploadProgressBar;
|
||||||
}());
|
}());
|
||||||
@@ -161,14 +162,14 @@ var UploadWorker = /** @class */ (function () {
|
|||||||
UploadWorker.prototype.upload = function (file) {
|
UploadWorker.prototype.upload = function (file) {
|
||||||
console.debug("Starting upload of " + file.name);
|
console.debug("Starting upload of " + file.name);
|
||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
formData.append('file', file.file);
|
|
||||||
formData.append("name", file.name);
|
formData.append("name", file.name);
|
||||||
|
formData.append('file', file.file);
|
||||||
var that = this; // jquery changes the definiton of "this"
|
var that = this; // jquery changes the definiton of "this"
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: apiEndpoint + "/file",
|
url: apiEndpoint + "/file",
|
||||||
data: formData,
|
data: formData,
|
||||||
timeout: 7200000,
|
timeout: 21600000,
|
||||||
cache: false,
|
cache: false,
|
||||||
async: true,
|
async: true,
|
||||||
crossDomain: false,
|
crossDomain: false,
|
||||||
@@ -192,7 +193,6 @@ var UploadWorker = /** @class */ (function () {
|
|||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
console.log("status: " + status + " error: " + error);
|
console.log("status: " + status + " error: " + error);
|
||||||
if (that.tries === 3) {
|
if (that.tries === 3) {
|
||||||
alert("Upload failed: " + status);
|
|
||||||
file.onFailure(status, error);
|
file.onFailure(status, error);
|
||||||
setTimeout(function () { that.newFile(); }, 2000); // Try to continue
|
setTimeout(function () { that.newFile(); }, 2000); // Try to continue
|
||||||
return; // Upload failed
|
return; // Upload failed
|
||||||
|
@@ -16,7 +16,7 @@ body{
|
|||||||
font-family: 'Ubuntu', sans-serif;
|
font-family: 'Ubuntu', sans-serif;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
text-align: center; /* Center the header and body */
|
text-align: center; /* Center the header and body */
|
||||||
line-height: 140%;
|
line-height: 1.5em;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
color: var(--text_color);
|
color: var(--text_color);
|
||||||
@@ -116,6 +116,7 @@ body{
|
|||||||
|
|
||||||
/* Common elements */
|
/* Common elements */
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6 {line-height: 1em;}
|
||||||
h3{border-bottom: 1px var(--accent_color_light_border) solid;} /* Differentiate it a bit, else it just looks like bold text */
|
h3{border-bottom: 1px var(--accent_color_light_border) solid;} /* Differentiate it a bit, else it just looks like bold text */
|
||||||
|
|
||||||
hr{
|
hr{
|
||||||
|
@@ -54,7 +54,8 @@ class UploadProgressBar implements FileUpload {
|
|||||||
this.uploadDiv.setAttribute('style', 'background: #821C40')
|
this.uploadDiv.setAttribute('style', 'background: #821C40')
|
||||||
this.uploadDivJQ.html(
|
this.uploadDivJQ.html(
|
||||||
this.file.name+'<br/>'
|
this.file.name+'<br/>'
|
||||||
+ 'Upload failed after three tries!'
|
+ 'Upload failed after three tries!<br/>'
|
||||||
|
+ "Message: " + error
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -68,8 +68,8 @@ class UploadWorker {
|
|||||||
console.debug("Starting upload of " + file.name)
|
console.debug("Starting upload of " + file.name)
|
||||||
|
|
||||||
var formData = new FormData()
|
var formData = new FormData()
|
||||||
formData.append('file', file.file)
|
|
||||||
formData.append("name", file.name)
|
formData.append("name", file.name)
|
||||||
|
formData.append('file', file.file)
|
||||||
|
|
||||||
var that = this // jquery changes the definiton of "this"
|
var that = this // jquery changes the definiton of "this"
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ class UploadWorker {
|
|||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: apiEndpoint+"/file",
|
url: apiEndpoint+"/file",
|
||||||
data: formData,
|
data: formData,
|
||||||
timeout: 7200000, // 2 hours
|
timeout: 21600000, // 6 hours, to account for slow connections
|
||||||
cache: false,
|
cache: false,
|
||||||
async: true,
|
async: true,
|
||||||
crossDomain: false,
|
crossDomain: false,
|
||||||
@@ -103,7 +103,6 @@ class UploadWorker {
|
|||||||
console.log("status: "+status+" error: "+error)
|
console.log("status: "+status+" error: "+error)
|
||||||
|
|
||||||
if (that.tries === 3) {
|
if (that.tries === 3) {
|
||||||
alert("Upload failed: " + status);
|
|
||||||
file.onFailure(status, error)
|
file.onFailure(status, error)
|
||||||
|
|
||||||
setTimeout(function(){that.newFile()}, 2000) // Try to continue
|
setTimeout(function(){that.newFile()}, 2000) // Try to continue
|
||||||
|
@@ -55,6 +55,18 @@
|
|||||||
relative to that URL.
|
relative to that URL.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<h2>Form value order</h2>
|
||||||
|
<p>
|
||||||
|
I recommend you put files at the end of every file upload form.
|
||||||
|
By doing this the pixeldrain server can respond to malformed
|
||||||
|
requests before the file upload finishes and this may save you a
|
||||||
|
lot of time and bandwidth when uploading large files. Make sure
|
||||||
|
your HTTP client has support for premature responses, pixeldrain
|
||||||
|
uses them a lot. If the server responds before your request is
|
||||||
|
finished it will always indicate an error and you may abort the
|
||||||
|
connection.
|
||||||
|
</p>
|
||||||
|
|
||||||
<h2>File Methods</h2>
|
<h2>File Methods</h2>
|
||||||
{{template "api-file-post"}}
|
{{template "api-file-post"}}
|
||||||
{{template "api-file-id-get"}}
|
{{template "api-file-id-get"}}
|
||||||
|
@@ -16,13 +16,6 @@
|
|||||||
<td>Default</td>
|
<td>Default</td>
|
||||||
<td>Description</td>
|
<td>Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>file</td>
|
|
||||||
<td>true</td>
|
|
||||||
<td>5 000 000 000 Bytes</td>
|
|
||||||
<td>none</td>
|
|
||||||
<td>Multipart file to upload</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>name</td>
|
<td>name</td>
|
||||||
<td>false</td>
|
<td>false</td>
|
||||||
@@ -30,6 +23,13 @@
|
|||||||
<td>Multipart file name</td>
|
<td>Multipart file name</td>
|
||||||
<td>Name of the file to upload</td>
|
<td>Name of the file to upload</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>file</td>
|
||||||
|
<td>true</td>
|
||||||
|
<td>5 000 000 000 Bytes</td>
|
||||||
|
<td>none</td>
|
||||||
|
<td>Multipart file to upload</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3>Returns</h3>
|
<h3>Returns</h3>
|
||||||
|
Reference in New Issue
Block a user