Skip to content

Commit 735fc5f

Browse files
committed
Document - cl_image_upload_tag
1 parent 9ece8ef commit 735fc5f

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,26 @@ Usage:
121121

122122
# <img src='http://res.cloudinary.com/cloud_name/image/upload/c_fill,h_100,w_100/sample.png' height='100' width='100'/>
123123

124+
### cl\_image\_upload\_tag
125+
126+
Returns an html input field for direct image upload, to be used in conjunction with [cloudinary\_js package](https://github.com/cloudinary/cloudinary_js/). It integrates [jQuery-File-Upload widget](https://github.com/blueimp/jQuery-File-Upload) and provides all the necessary parameters for a direct upload.
127+
You may see a sample usage of this feature in the PhotoAlbum sample included in this project.
128+
129+
Usage:
130+
131+
cl_image_upload_tag(post-upload-field-name, upload-options-array)
132+
133+
Parameters:
134+
135+
- `post-upload-field-name` - A name of a field in the form to be updated with the uploaded file data.
136+
If no such field exists a new hidden field will be creates.
137+
The value format is `<image-path>#<public-id>`.
138+
If the `cl_image_upload_tag` is not within an html form, this argument is ignored.
139+
140+
- `upload-options-array` - upload options same as in Upload section above, with:
141+
- html - an associative array of html attributes for the upload field
142+
143+
124144
### cl\_form\_tag
125145

126146
The following function returns an html form that can be used to upload the file directly to Cloudinary. The result is a redirect to the supplied callback_url.

samples/PhotoAlbum/upload.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,13 @@
5757
allow uploading directly to your Cloudinary storage -->
5858
<div id='direct_upload'>
5959
<br /><h1>Direct upload</h1>
60+
<form>
6061
<?php
62+
# The callback is set to a file on the local server which works-around restrictions in older IE
63+
# which don't implement CORS correctly.
6164
echo cl_image_upload_tag('test', array("tags" => "direct_photo_album", "callback" => $cors_location));
6265
?>
66+
</form>
6367
<div class="uploaded-info" style="display: none;">
6468
<div class="data"></div>
6569
<div class="image"></div>

0 commit comments

Comments
 (0)