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

Issue #219 Removed unneccessary additional / in situation with subdirectory usage #33

Closed
wants to merge 2 commits into from

Conversation

Nauzer
Copy link

@Nauzer Nauzer commented Jul 9, 2016

Resolved tomitrescak/meteor-uploads#219

Now the configuration you make in UploadServer.init.getDirectory is also consistent with how files get written to disk AND return in the fileInfo object.

Usage:

UploadServer.init({
            tmpDir: process.env.PWD + '/.uploads/tmp',
            uploadDir: process.env.PWD + '/.uploads',
            checkCreateDirectories: true, //create the directories for you
            finished: function(fileInfo, formFields) {
                fileInfo.customField = formFields.customField;
            },
            getDirectory: function(fileInfo, formFields) {
                if(formFields.customField) {
                    // to write in subdirectory give a postfix forward slash
                    return formFields.customField+"/";
                } else {
                    // to write in root directory return empty string or null
                    return ""; 
                }
            }
        });

@Nauzer Nauzer closed this Jul 9, 2016
@Nauzer Nauzer reopened this Jul 9, 2016
@Nauzer Nauzer closed this Jul 9, 2016
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.

Subdirectory creation 'double slashes'
1 participant