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

Drag and drop has path but direct browse does not #1605

Closed
genachka opened this issue May 28, 2019 · 3 comments
Closed

Drag and drop has path but direct browse does not #1605

genachka opened this issue May 28, 2019 · 3 comments
Assignees

Comments

@genachka
Copy link

genachka commented May 28, 2019

As noted here: #1509

I didn't want to hijack that issue as my use case is a little different. I actually need to know the full path that the direct file came from and the full path as well when the dropped file came from.

If I have 3 files:
--Folder a

  • file abc.png
  • file 123.jpg
    --Folder b
  • file 123.jpg

And the user selects the file file 123.jpg from Folder a the relative path will be ./ based on the solution you proposed in the referenced report. But then so when the user also selects the file file 123.jpg from Folder b the relative path will be ./ as well. And I need to maintain the folder structure of the uploaded files and with what's being proposed I won't be able to tell which file belongs in which folder on my server destination.

Further as I mentioned, is there any way to get the full path, not just the relative on the dropped as well as direct?

@arturi
Copy link
Contributor

arturi commented May 29, 2019

Hi!

And the user selects the file file 123.jpg from Folder a the relative path will be ./

With PR #1602, this should not be the case. The relativePath will either contain a folder in it, or be null.

This is what I get when I drag-drop a folder with files and a subfolder (in the aforementioned PR):

/images-folder/IMG_0575.jpg
/images-folder/more-folders/photo-1458724338480-79bc7a8352e4121.jpeg

⚠️ Note that this is about drag-dropping folders only. When selecting a file from a folder through “browse” system dialog, the browser doesn’t give us a path (only if you set file input to accept folders only).

The issue would arise if you have the same file across different folders, Uppy currently will just replace the duplicate file, so you end up with one instance. We were considering adding relativePath to file id, so that two copies of the same file from different folders would be allowed. See #1606.

@lakesare
Copy link
Contributor

lakesare commented May 29, 2019

And I need to maintain the folder structure of the uploaded files and with what's being proposed I won't be able to tell which file belongs in which folder on my server destination.

@genachka, there is no way to do it in Js (https://stackoverflow.com/questions/15201071/how-to-get-full-path-of-selected-file-on-change-of-input-type-file-using-jav).
We only ever get .relativePath when we drop a folder.
If we select a file any other way - we are not given its path, relative or absolute, its .relativePath will be null (once #1602 lands).

@lakesare lakesare self-assigned this May 31, 2019
@lakesare
Copy link
Contributor

Closing, as:

  1. getDroppedFiles.js - made .relativePath of nonfoldered files null #1602 was merged, all nonfoldered files have .relativePaths of null
  2. We can't find absolute paths of files, currently browsers don't offer this functionality.

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

3 participants