【问题标题】:file upload using bootstrap and jquery使用 bootstrap 和 jquery 上传文件
【发布时间】:2013-09-05 21:49:08
【问题描述】:

我编写了一个简单的 html 表单,用于使用引导框架和 jquery 上传文件。在服务器端,我尝试在文件上传成功后打印文件名。

问题是文件名没有被打印出来。我在服务器上做的是 echo $_FILE['file']['name'] 。完整的脚本在这里http://pastebin.com/eEpAy1Tg

我不太了解 jquery 和 bootstrap。由于 jquery 和 bootstrap,我可能没有成功上传文件。如果有人有经验并可以帮助我,我将不胜感激。

【问题讨论】:

  • 如果您将代码带到这里,我们可以为您提供帮助。在 stackoverflow 上的代码被清楚地突出显示。

标签: php jquery forms twitter-bootstrap


【解决方案1】:

试试;

改变

<form action="index1.php" method="post">

<form action="index1.php" method="post" enctype="multipart/form-data">

【讨论】:

  • 我刚试过。好吧,如果我这样做 print_r($_FILES['file1']['type']);它打印我“文本/纯文本”。如果我回显 $_FILE['file1']['type'];它什么也没打印。还有 print_r($_FILES);给出 Array ( [file1] => Array ( [name] => file.txt [type] => text/plain [tmp_name] => /tmp/phpHJj5h4 [error] => 0 [size] => 12 ) )条件 ($_FILE['file1']['type']== 'text/plain') 不正确...为什么?
猜你喜欢
  • 2017-04-10
  • 2015-03-23
  • 1970-01-01
  • 1970-01-01
  • 2023-03-21
  • 1970-01-01
  • 2017-05-12
  • 2013-10-09
  • 2018-02-24
相关资源
最近更新 更多