PHP和jQuery移动文件上传适用于桌面,但不适用于移动设备

PHP和jQuery移动文件上传适用于桌面,但不适用于移动设备,php,jquery,jquery-mobile,file-upload,Php,Jquery,Jquery Mobile,File Upload,以下是表单处理代码: $name = $_POST['name']; $score = $_POST['score']; $screenshot = time(); $screenshot .= $_FILES['screenshot']['name']; // the name of the file to save $target = GW_UPLOADPATH . $screenshot; $screenshot_size = $_FILES['screenshot']['size'];

以下是表单处理代码:

$name = $_POST['name'];
$score = $_POST['score'];
$screenshot = time();
$screenshot .= $_FILES['screenshot']['name']; // the name of the file to save
$target = GW_UPLOADPATH . $screenshot;
$screenshot_size = $_FILES['screenshot']['size'];
$screenshot_type = $_FILES['screenshot']['type'];
以下是HTML格式的表单(也包括jQuery):



您可能需要添加
$screenshot.=$\u文件['screenshot']['tmp\u name']jQuery mobile有时会修改原始HTML。我会在移动设备上查看呈现的源代码(无法告诉您如何在Android上执行)。好的,我在jQuery mobile Up and Running一书中读到了有关解决方案的内容。它必须是非ajax表单,因为jQuery自动将表单强制为ajax。以下代码供阅读的任何人参考:
<div data-role="page" id="main">
  <div data-role="header" style="text-align: left;font-size: 20px;">
        <?php if($mobile) echo $title; ?>
  </div><!-- /header -->
  <div data-role="content">
  <form enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <div data-role="fieldcontainer" class="score">
    <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo GW_MAXUPLOADSIZE; ?>" />
    <label for="name">Name:</label>
    <input type="text" id="name" name="name" value="<?php if (!empty($name)) echo $name; ?>" /><br />
    <label for="score">Score:</label>
    <input type="number" id="score" name="score" value="<?php if (!empty($score)) echo $score; ?>" /><br />
    <label for="screenshot">Screen shot:</label>
    <input type="file" id="screenshot" name="screenshot" />
    <input type="submit" value="Add" name="submit" />
    </div><!-- /fieldcontainer -->
  </form>