Line 18: | Line 18: | ||
* OnUploadCompleted( 0 , "/full/path/to/the/filename.txt", "filename.txt" ); : no errors found on the upload process. | * OnUploadCompleted( 0 , "/full/path/to/the/filename.txt", "filename.txt" ); : no errors found on the upload process. | ||
− | * OnUploadCompleted( 1, | + | * OnUploadCompleted( 1, "", "", "Reason" ); : the upload filed because of "Reason". Note: no paths being sent here, because uploading failed. |
* OnUploadCompleted( 201 , "/full/path/to/the/filename.txt(1)", "filename.txt(1)" ); : the file has been uploaded successfully, but its name has been changed to "filename(1).ext". | * OnUploadCompleted( 201 , "/full/path/to/the/filename.txt(1)", "filename.txt(1)" ); : the file has been uploaded successfully, but its name has been changed to "filename(1).ext". | ||
Note that uploaded file names may contain non ASC-II chars. | Note that uploaded file names may contain non ASC-II chars. |
Revision as of 15:10, 16 January 2008
QuickUpload
Adds a file in a folder. It generates a POST.
This command is pretty similar to the FileUpload command. It is used by FCKeditor 2.5.
Sample Request
Upload a file in the root directory of the resource type “Files”.
connector.php?command=QuickUpload&type=Files¤tFolder=%2F
The request will be done using POST (instead of GET) and the data will encoded in “multipart/form-data”. Only one field will be posted, named “NewFile”, containing the file uploaded data.
Sample Response
<script type="text/javascript"> window.parent.OnUploadCompleted(0, '/ckfinder/userfiles/files/filename.txt', 'filename.txt', '') ; </script>
This command doesn’t expect XML to be returned. Actually HTML must return with a <script> tag. The content type must be “text/html”. The "OnUploadCompleted" is a JavaScript function that is called to expose the upload result.
The possible values are:
- OnUploadCompleted( 0 , "/full/path/to/the/filename.txt", "filename.txt" ); : no errors found on the upload process.
- OnUploadCompleted( 1, "", "", "Reason" ); : the upload filed because of "Reason". Note: no paths being sent here, because uploading failed.
- OnUploadCompleted( 201 , "/full/path/to/the/filename.txt(1)", "filename.txt(1)" ); : the file has been uploaded successfully, but its name has been changed to "filename(1).ext".
Note that uploaded file names may contain non ASC-II chars.