javascript - How to accept add just media files (video and photo) and No All Files section - Stack Overflow

I have this at html page<input type="file" id="ajax-upload-id-1508413400253"

I have this at html page

<input type="file" id="ajax-upload-id-1508413400253" name="Media" accept="video/*,image/*" 
style="position: absolute; cursor: pointer; top: 0px; width: 100%; height: 
100%; left: 0px; z-index: 100; opacity: 0;">

And at .js

 manageMedia_Uploader = $("#fileuploader").uploadFile({
            url: "/Ajax/JsonProvider?Method=SaveMedia",
            fileName: "Media",
            autoSubmit: false,
            multiple: false,
            acceptFiles: "video/*,image/*",
            dynamicFormData: function () {
                return { MediaFriendlyName: $("#ManageMedia-MediaFriendlyName").val(), MediaID: mediaID }
            },


SaveMedia: function (mediaID) {

        if (mediaID == 0) {
            manageMedia_Uploader.startUpload();
        } else {
             //util
        }
    },

My problem is I want to just add picture and video nothing else. Thanks for this code give me 2 option while selecting files. Custom files and All files.

acceptFiles: "video/*,image/*",

How can i prevent All Files section ? Just Custom Files will appear ?

I have this at html page

<input type="file" id="ajax-upload-id-1508413400253" name="Media" accept="video/*,image/*" 
style="position: absolute; cursor: pointer; top: 0px; width: 100%; height: 
100%; left: 0px; z-index: 100; opacity: 0;">

And at .js

 manageMedia_Uploader = $("#fileuploader").uploadFile({
            url: "/Ajax/JsonProvider?Method=SaveMedia",
            fileName: "Media",
            autoSubmit: false,
            multiple: false,
            acceptFiles: "video/*,image/*",
            dynamicFormData: function () {
                return { MediaFriendlyName: $("#ManageMedia-MediaFriendlyName").val(), MediaID: mediaID }
            },


SaveMedia: function (mediaID) {

        if (mediaID == 0) {
            manageMedia_Uploader.startUpload();
        } else {
             //util
        }
    },

My problem is I want to just add picture and video nothing else. Thanks for this code give me 2 option while selecting files. Custom files and All files.

acceptFiles: "video/*,image/*",

How can i prevent All Files section ? Just Custom Files will appear ?

Share Improve this question edited Nov 22, 2017 at 7:39 Er.Er asked Oct 19, 2017 at 12:02 Er.ErEr.Er 1452 silver badges14 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

First you need to add input type="file" attribute, to accept media files, you can do it like this : HTML

<input type="file" id="ajax-upload-id-1508413400253" name="Media" accept="audio/*,video/*,image/*" 
style="position: absolute; cursor: pointer; top: 0px; width: 100%; height: 
100%; left: 0px; z-index: 100; opacity: 0;">

JS

manageMedia_Uploader = $("#fileuploader").uploadFile({
            url: "/Ajax/JsonProvider?Method=SaveMedia",
            fileName: "Media",
            autoSubmit: false,
            multiple: false,
            acceptFiles: "image/*, video/*",
            dynamicFormData: function () {
                return { MediaFriendlyName: $("#ManageMedia-MediaFriendlyName").val(), MediaID: mediaID }
            },


SaveMedia: function (mediaID) {

        if (mediaID == 0) {
            manageMedia_Uploader.startUpload();
        } else {
             //util
        }
    },

More :

http://hayageek./docs/jquery-upload-file.php

HTML Input="file" Accept Attribute File Type (CSV)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745649621a4638181.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信