plugin-CsvImport
plugin-CsvImport copied to clipboard
Local path for file imports
A feature idea I'd like to work on is adding support for local paths for files. Instead of relying on a full HTTP address being in the CSV file, allow people to upload the files to a server somewhere, and let them specify a path as the base bath for import along with the other settings for that CSV file.
This is usually the most problematic thing I encounter helping folks import their data from a CSV file, is that they usually only have the filenames, and not a full path. I've just been doing file and replace in the files column of the CSV file, which works fine, but I think being able to specify a base path for files would be useful.
Would like to talk this out more, since I'm sure I'm not aware of all the things such a change would affect.
Were you thinking that the base path be a setting for the entire import, or on a per column basis? Would it check to see if the file is a valid URL, and if not, then use the base file path setting?
I'd be a bit leery about this, given the security considerations: you could tailor a base path and your CSV to pull in any file on the server that the webserver can access.
I've thought about this before, but more as an integration with Dropbox: let users specify a particular column refers to files in the dropbox dir. There'd still need to be some checking on the filenames to make sure they're not trying to traverse the directory structure and break out of the dropbox (things like ..
).
@willynilly
Were you thinking that the base path be a setting for the entire import, or on a per column basis?
Was thinking for the entire import, but if there are be reasons to consider it on a per-column basis, would like to hear them.
Would it check to see if the file is a valid URL, and if not, then use the base file path setting?
Hadn't considered this, but seems like it'd be a good idea!
@zerocrates
I'd be a bit leery about this, given the security considerations: you could tailor a base path and your CSV to pull in any file on the server that the webserver can access.
Excellent point that I hadn't considered!
I've thought about this before, but more as an integration with Dropbox: let users specify a particular column refers to files in the dropbox dir. There'd still need to be some checking on the filenames to make sure they're not trying to traverse the directory structure and break out of the dropbox (things like ..).
Yeah, this seems more like it. That you'd have to either have Dropbox installed, or maybe add a directory to CsvImport that it could use. Agreed about checking the file paths, and prohibit breaking out of a specified directory.
@clioweb @zerocrates Do you want to use the Dropbox plugin or should we add a directory to the CsvImport plugin? What do yal think?