• <legend id='cpqft'><style id='cpqft'><dir id='cpqft'><q id='cpqft'></q></dir></style></legend>

    1. <small id='cpqft'></small><noframes id='cpqft'>

      • <bdo id='cpqft'></bdo><ul id='cpqft'></ul>
      <tfoot id='cpqft'></tfoot>

      <i id='cpqft'><tr id='cpqft'><dt id='cpqft'><q id='cpqft'><span id='cpqft'><b id='cpqft'><form id='cpqft'><ins id='cpqft'></ins><ul id='cpqft'></ul><sub id='cpqft'></sub></form><legend id='cpqft'></legend><bdo id='cpqft'><pre id='cpqft'><center id='cpqft'></center></pre></bdo></b><th id='cpqft'></th></span></q></dt></tr></i><div id='cpqft'><tfoot id='cpqft'></tfoot><dl id='cpqft'><fieldset id='cpqft'></fieldset></dl></div>
      1. 通过 PHP 表单进行 FTP 上传

        FTP upload via PHP form(通过 PHP 表单进行 FTP 上传)
        <legend id='MrhLY'><style id='MrhLY'><dir id='MrhLY'><q id='MrhLY'></q></dir></style></legend>

            <tbody id='MrhLY'></tbody>

        • <small id='MrhLY'></small><noframes id='MrhLY'>

            <bdo id='MrhLY'></bdo><ul id='MrhLY'></ul>
            1. <i id='MrhLY'><tr id='MrhLY'><dt id='MrhLY'><q id='MrhLY'><span id='MrhLY'><b id='MrhLY'><form id='MrhLY'><ins id='MrhLY'></ins><ul id='MrhLY'></ul><sub id='MrhLY'></sub></form><legend id='MrhLY'></legend><bdo id='MrhLY'><pre id='MrhLY'><center id='MrhLY'></center></pre></bdo></b><th id='MrhLY'></th></span></q></dt></tr></i><div id='MrhLY'><tfoot id='MrhLY'></tfoot><dl id='MrhLY'><fieldset id='MrhLY'></fieldset></dl></div>

                  <tfoot id='MrhLY'></tfoot>
                  本文介绍了通过 PHP 表单进行 FTP 上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想通过 FTP 上传表单中的文件.

                  I want to upload a file via FTP upload in a form.

                  <html>
                    <body>
                      <form enctype="multipart/form-data" action="upload_file.php" method="POST">
                        <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
                        Choose a file to upload: <input name="uploadedfile" type="file" /><br />
                        <input type="submit" value="Upload File" />
                      </form>
                    </body>
                  </html>
                  

                  这里是 PHP 文件:

                  Here is the PHP file:

                  <?php
                  
                  $ftp_server = "xxx";
                  $ftp_username   = "xxx";
                  $ftp_password   =  "xxx";
                  
                  // setup of connection
                  $conn_id = ftp_connect($ftp_server) or die("could not connect to $ftp_server");
                  
                  // login
                  if (@ftp_login($conn_id, $ftp_username, $ftp_password))
                  {
                    echo "conectd as $ftp_username@$ftp_server
                  ";
                  }
                  else
                  {
                    echo "could not connect as $ftp_username
                  ";
                  }
                  
                  $file = $_FILES["file"]["name"];
                  $remote_file_path = "/home/www/lifestyle69/import/".$file;
                  ftp_put($conn_id, $remote_file_path, $file, FTP_ASCII);
                  ftp_close($conn_id);
                  echo "
                  
                  connection closed";
                  
                  ?>
                  

                  FTP连接成功,但文件不存在.

                  The FTP connection connects successfully but the file is nowhere.

                  谁能帮帮我?

                  谢谢!

                  推荐答案

                  因为你有 <input name="uploadedfile" type="file"/>:

                  $file = $_FILES["file"]["name"]; // wrong
                  $file = $_FILES["uploadedfile"]["name"]; // right
                  

                  因为你需要PHP存储的临时副本的文件名,它存在于服务器上:

                  Because you need the filename of the temporary copy stored by PHP, which exists on the server:

                  ftp_put($conn_id, $remote_file_path, $file, FTP_ASCII); // wrong
                  ftp_put($conn_id, $remote_file_path, $_FILES["uploadedfile"]["tmp_name"],
                          FTP_ASCII); // right
                  

                  有关详细信息,请参阅 PHP 文档大约 $_FILES.

                  Refer to the PHP documentation for more information about $_FILES.

                  这篇关于通过 PHP 表单进行 FTP 上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                  1. <tfoot id='DZHa8'></tfoot><legend id='DZHa8'><style id='DZHa8'><dir id='DZHa8'><q id='DZHa8'></q></dir></style></legend>
                          • <bdo id='DZHa8'></bdo><ul id='DZHa8'></ul>
                              <tbody id='DZHa8'></tbody>
                          • <i id='DZHa8'><tr id='DZHa8'><dt id='DZHa8'><q id='DZHa8'><span id='DZHa8'><b id='DZHa8'><form id='DZHa8'><ins id='DZHa8'></ins><ul id='DZHa8'></ul><sub id='DZHa8'></sub></form><legend id='DZHa8'></legend><bdo id='DZHa8'><pre id='DZHa8'><center id='DZHa8'></center></pre></bdo></b><th id='DZHa8'></th></span></q></dt></tr></i><div id='DZHa8'><tfoot id='DZHa8'></tfoot><dl id='DZHa8'><fieldset id='DZHa8'></fieldset></dl></div>

                            <small id='DZHa8'></small><noframes id='DZHa8'>