Reputation: 1322
I'm trying to do cloudinary unsigned uploads. I have the file tag in html, and now I'm trying to initialize it via JavaScript. However, I'm recieving wonderful errors, that state $.cloudinary.unsigned_upload_tag is not a function
. Here's the revelant code:
Library inclusions
<script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/cloudinary/cloudinary_js/master/js/jquery.ui.widget.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/cloudinary/cloudinary_js/master/js/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/cloudinary/cloudinary_js/master/js/jquery.fileupload.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/cloudinary/pkg-cloudinary-jquery/master/cloudinary-jquery.min.js"></script>
Upload tag
<input type="file" id="selectedFile" style="" />
Initializing JS
$.cloudinary.config( { cloud_name: "wearnator"});
$("#selectedFile").append($.cloudinary.unsigned_upload_tag("af8fvvkw",{ cloud_name: 'wearnator' }));
The error is on the append line. More curiously, whenever I select a file, the upload is triggerred, but it uploads the sample picture of flowers.
Upvotes: 0
Views: 747
Reputation: 1931
The input field should include a name="file"
attribute:
<input type="file" name="file" id="selectedFile" />
And the JS initializing should be:
$("#selectedFile").unsigned_cloudinary_upload("af8fvvkw",{ cloud_name: 'wearnator' });
Let me know if it works for you?
Upvotes: 1