douhua1890 2018-10-31 04:09
浏览 20

在上载时,根据填充的单元格重命名文件

There are lots of questions about renaming files when they are uploaded. What I'd like to do is take it a step further.

Is there a way to have my users answer some questions and then name a file they've uploaded based on their answers?

For example: a user answers the questions, "what is your name?" "what is the number of your document?" "what is your department?" with: "Bob", "44", and "Programming" respectively.

Then then upload their document. The system then renames their document "Programming_bob_044" and – for good measure – maybe throws in the date too?

Is there a way to do this? Thank you!

  • 写回答

1条回答 默认 最新

  • doulidai6316 2018-10-31 04:18
    关注
    $img_dir = "upload/";
    $temp = explode(".", $_FILES["file"]["name"]);
    $img = $img_dir .$_POST['job'].'_'.$_POST['name'].'_'.$_POST['age'].'.' .end($temp);
    move_uploaded_file($_FILES['file']['tmp_name'], $img);
    

    Try this code. You get the answers with POST then put it in your image name

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大