Using the Grid we've have a project where a large number of files have been uploaded with spaces in the file names. We want to encode the URLs so the files can be downloaded.

To try to solve this we used CE String and {exp:ce_str:ing urlencode}{file_url}{/exp:ce_str:ing} but it doesn't seem to fix the issue.

Allow PHP is set to Yes and Parsing Stage is Output.

Any suggestions or alternatives would be greatly appreciated.


I believe ExpressionEngine actually takes care of the issue for you by automatically encoding the spaces as %20. You shouldn't need to use a plugin or enable PHP.

To check this just output the Grid row's {file_url} and you should see it encoded.


If the file you uploaded was named some file.png then the output of the above should be /my_upload_dir_path/some%20file.png

Is this not what you observe? Let me know if this misses the boat somehow.

As an aside, the EE file fieldtype seems to automatically convert spaces in filenames to underscores on upload, so I believe this shouldn't even come up unless you uploaded via another means.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.