Saves a file to the repository from the local file system,
with the option of creating a new version of the file if it already
exists.
uploadFile(source,target,versionFlag)
Table 2. Return
value for uploadFile
| Type |
Description |
String |
URI of the uploaded file |
Table 3. Exceptions
for uploadFile
| Type |
Description |
ResourceNotFoundException |
The source file or target folder does not exist. |
ResourceAlreadyExistsException |
A file or folder with the same name as the source file exists
in the target folder and the versionFlag parameter
is not specified. |
InsufficientParameterException |
Required parameters are not specified. |
Example
This example uploads the file MyReport.rptdesign to
the /Demo/Drafts folder in the repository. If the file already
exists, a new version of the file is uploaded using the versionFlag parameter.
from pes.util.PESExceptions import *
from pes.api.PESImpl import PESImpl
pesImpl = PESImpl("admin", "spss", "localhost", "8080")
try:
uri = pesImpl.uploadFile(source="C:\Demo\MyReport.rptdesign",target="/Demo/Drafts")
print "URI for the uploaded file is: ", uri
except ResourceAlreadyExistsException:
uri = pesImpl.uploadFile(source="C:\Demo\MyReport.rptdesign",target="/Demo/Drafts",
versionFlag=True)
print "URI for the uploaded file is: ", uri