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 & drop folder : add full path to the file object #285

Closed
sergiofbsilva opened this issue Jul 29, 2014 · 9 comments
Closed

drag & drop folder : add full path to the file object #285

sergiofbsilva opened this issue Jul 29, 2014 · 9 comments

Comments

@sergiofbsilva
Copy link

When a folder is dropped it will flatten all the files in the $files array.
It would be good to have the fullpath in each file.

@sergiofbsilva
Copy link
Author

related to #238

@danialfarid
Copy link
Owner

Does your server handle the folder upload? I think this feature very much depends on the server implementation. As for the client only Chrome and recent Opera versions supports drag and drop folders so this feature would not be cross browser.
I am not sure how you could sent the folder as a form data entry, what would be the content and how do you differentiate between a folder and a file? Also how can you tell if a file is inside another folder?
I don't think HTML5 folder drag and drop is quiet there yet.

@sergiofbsilva
Copy link
Author

my idea is to send for each file the fullpath on the clientside. That info is already there in the items when you do the traverseTree it is just a matter of putting it in the file object. I can deal with the recreation of the folder structure in the serverside with no problems.

So the upload could send the match filename -> filepath in the data param or something similar.

@danialfarid
Copy link
Owner

Ok so what you are suggesting is to just send the files not folders but change the name of the files to be the relative path + name of the file. Right?

@sergiofbsilva
Copy link
Author

Yes or just put in the file object a property called fullpath and let us do the concat if needed.

To change the name to the absolute path maybe is not a good idea for other people and would be an incompatible api change I think.

@danialfarid
Copy link
Owner

Ok, I can add an extra field to the file object like _relativePath that contains the relative path to that file, then when you upload you can send that data along with the file or change the file name whichever works better for you on the server side.

@sergiofbsilva
Copy link
Author

  • FolderX
    • Folder Y
      • a.txt
    • b.txt

If I drag FolderX I expect that a.txt has the path /FolderX/FolderY and b.txt has the path /FolderX

Don't really know what is the best name for the property though.

@danialfarid
Copy link
Owner

Version 1.6.5 now has file._relativePath variable which you can send along with the file to the server to know the directory structure on the client side.

@danialfarid
Copy link
Owner

It is renamed to file.path instead of file._relativePath.

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

2 participants