Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kobrynovych opened this issue Oct 16, 2023 · 1 comment

Comments

@kobrynovych
Copy link

kobrynovych commented Oct 16, 2023

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();
      }
  },
},

@kobrynovych
Copy link
Author

I would appreciate any information on this matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant