Skip to content

Why can't I drag and drop a file from my mobile phone if it's connected via USB? #454

Open
@kobrynovych

Description

I connected via USB my android phone to my windows 10 pc and i can't drag the file to my site but i can do it on your site
https://lian-yue.github.io/vue-upload-component/#/en/examples/drag

I already took all your code for myself, but it did not help, I think there must be some other settings for this case that you did not specify in the test code
https://github.com/lian-yue/vue-upload-component/blob/master/docs/views/examples/Drag.vue

NOTES:
files that are already on my computer drag and drop fine

I use:
"vue": "^2.7.14",
"vue-upload-component": "^2.8.23",

<file-upload
    :ref="refUploadId"
    :name="refUploadId"
    :maximum="maximum"
    class="d-none"
    post-action="/media/upload"
    :multiple="true"
    :drop="true"
    :drop-directory="true"
    :accept="`video/quicktime,video/mp4,video/webm,video/x-matroska,audio/mpeg,audio/wav,image/png,image/jpeg,image/bmp`"
    v-model="files"
    :size="maxFilesSizeToUpload"
    @input-filter="inputFilter"
>
</file-upload>


methods: {            
  inputFilter(newFile, oldFile, prevent) {
      if (newFile && !oldFile && /(\/|^)(Thumbs\.db|desktop\.ini|\..+)$/.test(newFile.name)) {
          return prevent();
      }

      if (newFile && !oldFile && /\.(php5?|html?|jsx?)$/i.test(newFile.name)) {
          return prevent();
      }

      if (newFile && !oldFile && !this.isSuperAdmin(this.$page.props.user.role_id) && !/\.(mp4?)$/i.test(newFile.name) && Number((newFile.size / 1024 / 1024).toFixed(2)) > this.maxFilesSizeToUpload ) {
          return prevent();
      }

      if (newFile && !oldFile && this.allowImages) {
          if (!/\.(mp4?|mov?|mkv?|webm?|mp3?|wav?|jpeg?|jpg?|jpe?|png?|heic?|heif?|bmp?)$/i.test(newFile.name)) {
              return prevent();
          }
      } else if (newFile && !oldFile && !/\.(mp4?|mov?|mkv?|webm?|mp3?|wav?)$/i.test(newFile.name)) {
          return prevent();
      }
  },
},

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions