First import javascript file.
<script type="text/javascript" src="assets/js/sbImageUploader.js"></script>
Add image container div inside body tags.
<body>
...
.
.
<div class="sbImageContainer"></div>
.
.
...
</body>
Call init method, it will be ready for use.
sbImageUploader.init();
Inıt method with additional parameters.
sbImageUploader.init();
{
uploadButtonText : "Yükle",
startNumber : 3,
maxImageNumber : 10,
contentTypeErrorMessage : "Yalnızca jpeg, gif, bmp ve png dosyaları yükleyebilirsiniz.",
acceptableTypes : ["image/gif", "image/jpeg", "image/png","image/bmp"],
}
Get uploaded files with get method.
sbImageUploader.get();
Need json array output from backend.
- First element of array indicate as boolean, upload succes or fail.
- Second element of array indicate uploaded image filename.
Example output :
[true,"img.jpg"]
- Register done function after image uploads.
- Store filename received from backend or client.
- Upload error message from backend.
- Improvement for style.css, right now like a trash.