nicolant Posted September 20, 2022 Share Posted September 20, 2022 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 More sharing options...
AndZyk Posted September 22, 2022 Share Posted September 22, 2022 Hello @nicolant, maybe you could try this module mentioned here: But I would always store HTML, CSS and JS files in the templates directory. ? Regards, Andreas Link to comment Share on other sites More sharing options...
nicolant Posted September 23, 2022 Author Share Posted September 23, 2022 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 More sharing options...
Robin S Posted September 23, 2022 Share Posted September 23, 2022 @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 2 1 Link to comment Share on other sites More sharing options...
nicolant Posted September 25, 2022 Author Share Posted September 25, 2022 @Robin S, thank you! I think this is what I need. I'd prefer to eliminate the use of dots, but the bundler I use for those "blocks" (Parcel) always adds hashes to file names Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now