ruby 生成随机文件名并保存旧的已保存文件名(CarrierWave FTP)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ruby 生成随机文件名并保存旧的已保存文件名(CarrierWave FTP)相关的知识,希望对你有一定的参考价值。

  def filename
    if original_filename
      if model && model.read_attribute(mounted_as).present?
        model.read_attribute(mounted_as)
      else
        "#{SecureRandom.hex}.#{File.extname(file.filename)}"
      end
    end
  end

以上是关于ruby 生成随机文件名并保存旧的已保存文件名(CarrierWave FTP)的主要内容,如果未能解决你的问题,请参考以下文章

C程序 生成随机数并存入.txt文件

如何在不使用 Ruby 保存到磁盘的情况下生成 zip 文件?

如何在 Delphi 中添加越来越多的已保存文件?

用 C fopen 保存文件

Python 脚本生成测试数据,Python生成随机数据,Python生成大量数据保存到文件夹中

查看由IOS应用程序生成的已保存控制台日志