简体   繁体   English

如何:上传文本文件并与PHP脚本一起使用

[英]How To: Upload text file and use with PHP script

Is it possible to achieve the following: 是否有可能实现以下目标:

  1. Allow a user to upload a text file via HTML form (.txt) 允许用户通过HTML表单(.txt)上传文本文件
  2. Use the contents of that file in a PHP script to temporarily access the information 在PHP脚本中使用该文件的内容来临时访问信息
  3. Delete any traces of the temporary file after the script has processed? 脚本处理后,删除临时文件的任何痕迹吗?

Think of it as uploading a word document via html form, have a php script as basic as: 可以认为它是通过html表单上传word文档,并具有基本的php脚本,例如:

<?php

$document = file_get_contents("uploaded_document.txt");

echo $document;

$document = "";

?>

Thank you ahead of time! 提前谢谢你!

unlink($_FILES["txt_file"]["tmp_name"]);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM