I am uploading a file, that contains spaces in the name, to Amazon S3 using cffile action="upload"
. The file name is burger+beans n beetroot.jpg
.
As you can see, the name contains spaces and a plus sign.
When I read the directory, to list the contents, the file name returned by ColdFusion in the query is: burger+beans+n+beetroot.jpg
. However, when viewing the file using Amazon S3 Browser, it is correctly listed as: burger+beans n beetroot.jpg
. So it appears ColdFusion is replacing the spaces with +
signs.
Does anyone know why this happens and if there is a way to disable this? I tried using both the DirectoryList()
method as well as the <cfdirectory action="list">
tag, and both do this.
Please note: I am aware that the file name could be cleaned up before processing - that's a workaround, but not the solution I am looking for. Thanks!
I believe this is not a CF problem, it's a S3 problem. They send out their file names escaped. Which makes this a non-answer.
I created a folder in a S3 bucket. Then I uploaded a file named burger+beans n beetroot.jpg
. I can see in AWS' console the file properly named. I select it, then in the Actions menu select Download. I get the modal window. Take a look at the URL in the browser footer - the file name is escaped.
I right-click their link and choose "Save Link As..." - the file name is escaped as well.
So I don't think there is anything you can do once the file is up there. You'll need to clean it before uploading. I know it's not what you want to hear.