Generally, the upload of images is not one or two. We need to upload images in batches. We cannot upload too many images at a time. We cannot upload images at a time.
In view of this, I used JS as a multi-File Upload demo. Combined with ASP, I am still using such an old language. I am also trying to learn it with the rest of the time.
Requirements:
1. You can add or delete file form controls.
2. Verify validity during upload
3. Determine the file format
4. The server renames and saves the uploaded files.
5. Limit the maximum number of files uploaded at a time
Demo:
Note: I used the chemical environment of the old rice farmers without components. I made a slight change.
Added a public function makefilename (EXT). The returned value is a random file name generated based on the extension.
Format: Date (8 bits) + time (6 bits) + random number (3 bits), for example, 20080901164412999.jpg
This is mainly to avoid duplicate names when uploading multiple files at a time, and to avoid duplicate names with existing files on the server.
A simple GIF format demonstration is provided. A prompt is displayed when more than 10 files are added! A txt document was uploaded intentionally, and the verification failed.
You can see the uploaded document in the upload folder.
Code: multifileupload.rar