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

pass req to the getFileName and getDirectory #30

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

titovanton
Copy link

It is very small patch:

-  getDirectory: function (fileInfo, formData) {
+  getDirectory: function (req, fileInfo, formData) {
-  getFileName: function (fileInfo, formData) {
+  getFileName: function (req, fileInfo, formData) {

This parameter let me handle re.query inside getDirectory, where i can pass the HTTP GET parameter to manipulate of subdirectory path from the client.

@titovanton
Copy link
Author

Ok, I found the bug...
First of all, I want to say thank you for ur upload-server. It works. But u do not follow conventions :/ , so ur code is very hard to read(especially for noobs like me).
Also, always use path.join instead concatination(that's about ur bug):

-    var destinationFile = currentFolder + newFileName;
+    var destinationFile = path.join(currentFolder, newFileName);

@titovanton
Copy link
Author

titovanton commented May 6, 2016

so, the result of ur concatination is:

/path/tofilename

instead:

/path/to/filename

there r alot of concatinations in ur code more, but it seems it works :) It would be awesome to refactor ur code and cover with tests...

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

Successfully merging this pull request may close these issues.

1 participant