addFile
Encapsulates the API AddFile function, which adds a file to the wiki (which will reside in the /f/ directory).
jpal.addFile(file,data,handler)
file is the file name.
data is the data to upload.
handler is the function that receives the returned object.
On success, the returned object will have the uploaded property set to "w00t", otherwise, errCode and error will be set. The function will fail if the file already exists.
Example:
var text = 'This is some text.';
function handleUpload(result) {
if (result.uploaded && result.uploaded=='w00t') alert('Success!')
else if (result.error) alert('Error: ' + result.error);
}
jpal.addFile('myfile.txt',text,handleUpload);
Comments (0)
You don't have permission to comment on this page.