Support

Account

Home Forums Backend Issues (wp-admin) multiple file upload (subtitles)

Solving

multiple file upload (subtitles)

  • hello,
    i have many posts that contain one video. Now i want in the via backend form to add subtitle files, like this, field names:
    upload_file_vtt_english
    upload_file_vtt_dutch

    the user uploads subs1.vtt , subs2.vtt etc

    what is the best way to go here, so that in frontend i know which is the english subtitle file and which is the dutch one?

    in the frontend i want to pick up the file ‘last moment’ with wp plugin webvtt.
    i have tried several things. like rename attachment before save (difficult), use hidden field (difficult).

    i have latest acf-pro. thanks jan

  • I am not familiar with webvtt, but would the following work for you?

    "key": "Videos",
    "title": "Videos",
    "fields": [{
    	"key": "video_file",
    	"label": "Video File",
    	"name": "video_file",
    	"type": "file",
    	"required": 1,
    	"return_format": "array",
    	"library": "all",
    },{
    	"key": "subtitles",
    	"label": "Subtitles",
    	"name": "subtitles",
    	"type": "repeater",
    	"required": 0,
    	"min": 0,
    	"max": 0,
    	"sub_fields": [{
    		"key": "language",
    		"label": "Language",
    		"name": "language",
    		"type": "select",
    		"required": 1,
    		"choices": {
    		    "English": "English",
    		    "Dutch": "Dutch"
    		},
    		"return_format": "value",
    	},{
    		"key": "language_file",
    		"label": "File",
    		"name": "file",
    		"type": "file",
    		"required": 1,
    		"return_format": "array",
    		"library": "all",
    	}]
    }]
  • Deleting comment. I see you are using an additional plugin. Thanks!

  • yazminmedia,
    Fortunately, I got an email before you deleted your comment. The additional plugin use was fairly inconsequential to the question. (Or I assumed so in my answer given)

    In short, you can use a repeater to attach multiple files. If you need additional data on those files you can put those additional fields in the repeater.

    In the example from jaro, they only needed 1 video, but multiple subtitle files which each needed their own additional data (what language they were)

    If you happened to need multiple videos, and each of those needed multiple subtitle files with additional data, you could just nest the repeaters.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.