Jump to content

How to upload files with dots in a file name?


nicolant
 Share

Recommended Posts

I have a bunch of html, js and css files with names in form of name.hash.ext. How to upload them with Files inputfield as ZIP archive and uncompress without replacing first dot with underscore?
Maybe, it is possible to redefine ProcessWire\WireUpload::validateFilename in unobtrusive way (as module)?..

Link to comment
Share on other sites

Thank you, @AndZyk

I can not understand, how to configure that module in order to retain original file names. If I set Filename Format to {$file->name} then dots become replaced by hyphens instead of underscores...
I tried to dig into code of module, but it seems too complicated for me 😞, because my field is inside repeater.

The reason behind decision not to store files in templates directory is that these files are "blocks", like, for example, small HTML games, and I need to provide mehanism for upload them 

 

Link to comment
Share on other sites

@nicolant, ProcessWire doesn't allow filenames to include dots, perhaps because Images fields use a dot to separate the variation suffix from the basename and Images and Files fields share some of the same code.

If using dots in the filename is essential for some reason and you are willing to use an experimental module you could try this: https://github.com/Toutouwai/FieldtypeFileUnrenamed

image.png.429258d6560662c57adc418c8dde19a2.png

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...