This chapter describes how you can preview a picture after you've created it, and you'll be able to support uploading it.
The code is as follows (Connection address: https://github.com/xiexingen/Bootstrap-SmartForm/blob/master/demo/form3-ele-img.html):
- dependent on the Jquery-file-upload plug-in, you need to reference Jquery.ui.widget.js, Jquery.iframe-transport.js, jquery.fileload.js
- Call
global.Fn.InitPlugin(‘img‘,‘formContainer‘);
Formcontainer: For the form ID, narrow the look-up range, optional
- The principle of this plugin is to upload the image to the server, and then the server returns the path of the picture storage, the last time the form is submitted to the image of the path to the server storage, parameter description:
ID: ' Can be arbitrarily given, mainly used to distinguish '
Multiple: ' True ', whether to allow multiple files when uploading
Name: When uploading a file, the submitted key
Extendattr:field: When saving a form, the key name sent is handle: optional [single|mutiple|null] if it is single, the uploaded picture will replace the existing picture, otherwise it will be appended to the current picture
URL: Image upload submitted URL, you can also modify the Global.js file in the global.Fn.InitUploadImage inside the default values
Note: This method defaults to the returned JSON format: {result:200,imgurl: ' ... '},result:200 to show that the picture was uploaded successfully!
Run:
Previous chapter:BootStrap Smart Form series eight form configuration json detailed
Previous chapter: BootStrap smart Form Series 10 auto-complete component support
Series Home: BootStrap smart Form Series Home
BootStrap Smart form series nine form picture upload support