jQuery fileupload - get list of uploaded files

后端 未结 10 1877
天涯浪人
天涯浪人 2020-12-14 23:49

I\'m using the very good jquery plugin blueimp / jQuery-File-Upload

$(\'#fileupload\').fileupload({
  autoUpload: true
, filesContainer: \'#attachments_prese         


        
10条回答
  •  死守一世寂寞
    2020-12-15 00:04

    To get the list of uploaded file names from the server, requires server-side code:

    UploadHandler.php is used to upload files to a directory/s on your server.

    If you've downloaded the plug-in archive and extracted it to your server, the files will be stored in php/files by default. (Ensure that the php/files directory has server write permissions.) see: https://github.com/blueimp/jQuery-File-Upload/wiki/Setup

    UploadHandler.php is just that, an upload handler. It does not provide access to server files without a connection to the server.

    JavaScript cannot access files on the server, so you'll need a php script to do so. (Although JavaScript could possibly keep track of everything uploaded, renamed, and deleted.)

    You can modify UploadHandler.php to connect to your database, and write the file paths (and any other data) to a files table during upload. Then you can access your files via standard SQL queries:

    Modify UploadHandler.php:

    1. Add your database connection parameters
    2. Write an SQL query function
    3. Write a second function to perform your query
    4. Call the second function

    see: https://github.com/blueimp/jQuery-File-Upload/wiki/Working-with-databases

提交回复
热议问题