(New page: == FileUpload == Adds a file in a folder. It generates a POST === Sample Request === Upload a file in the root directory of the resource type “Files”. <pre>connector.php?command=Fil...) |
|||
Line 1: | Line 1: | ||
+ | {{CKFinder_SSI_Warning}} | ||
== FileUpload == | == FileUpload == | ||
Revision as of 15:35, 16 January 2008
FileUpload
Adds a file in a folder. It generates a POST
Sample Request
Upload a file in the root directory of the resource type “Files”.
connector.php?command=FileUpload&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, '' ) ; </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 ) : no errors found on the upload process.
- OnUploadCompleted( 1, 'Reason' ) : the upload filed because of "Reason".
- OnUploadCompleted( 201, 'FileName(1).ext' ) : the file has been uploaded successfully, but its name has been changed to "FileName(1).ext".
- OnUploadCompleted( 202 ) : invalid file.
Note that uploaded file names may contain non ASC-II chars.