One browse (that is, selecting a file but not uploading) and one save (click this to upload ). How to write this business logic? Because the files are automatically uploaded after the file is selected, the "save" button is broken.
One browsing (that is, selecting a file but not uploading it)
Save one (click to upload ).
How to write this business logic? Because the files are automatically uploaded after the file is selected, the "save" button is broken.
Reply content:
One browsing (that is, selecting a file but not uploading it)
Save one (click to upload ).
How to write this business logic? Because the files are automatically uploaded after the file is selected, the "save" button is broken.
You can configure the plug-in.
If you write it yourself, select the image and do not allow him to request the interface.
Image preview. This is mainly done at the front end. When you click Save, you can submit the content to the server. For details, refer
Https://github.com/zp1996/myUpload/blob/master/upload.js
The statement is missing.
The jquery uploadify plug-in is used. It has an upload success callback address parameter uploadsuccess.
I'm wondering how to handle it more securely.
Supplement:
I am thinking that the user has uploaded the image, but has not saved the path to the database, and then the user has changed the image.
In this case, can I only write a shell script to regularly delete images in the upload directory?
After selecting an image for browsing, the image has actually been uploaded to the server. The returned server address is in a hidden form. When you click Submit, bind the image to the user.
This part is involved in the project.
Preview can be solved directly at the front end
$ (Upload file Input ). change (function () {var file = this. files [0]; var r = new FileReader (); r. readAsDataURL (file); $ (r ). load (function () {// The key lies in this. result (selector).html(''background .css ('background ', 'url (' + this. result + ')');})});
After previewing, I used Ajax to upload images.