javaScript(图像)变量转换为php变量

javaScript(图像)变量转换为php变量,javascript,Javascript,我是javaScript新手,我在互联网上找到了这个用于预览图像的java脚本。 我无法将图像的java变量发送到php文件。我尝试过使用html框,但无法将变量输入php。我也尝试过使用reader.onload、newfilereader、blah、blar等作为html字段中的变量,但这些变量似乎都不能作为变量,也尝试过不使用echo语句。任何关于这方面的建议都将不胜感激 <html> <head> <link class="jsbin" href="http

我是javaScript新手,我在互联网上找到了这个用于预览图像的java脚本。 我无法将图像的java变量发送到php文件。我尝试过使用html框,但无法将变量输入php。我也尝试过使用reader.onload、newfilereader、blah、blar等作为html字段中的变量,但这些变量似乎都不能作为变量,也尝试过不使用echo语句。任何关于这方面的建议都将不胜感激

<html>
<head>
<link class="jsbin" href="http://ajax.googleapis.com/ajax/libs/jquerzyui/1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"></script>
<script type="text/javascript">
function readURL(input)
{
      if (input.files && input.files[0])
              {
                   var reader = new FileReader();
                   reader.onload = function (e)
                                          {
                                                $('#blah')
                                                .attr('src',e.target.result)
                                                .width(150)
                                                .height(200);
                                          };
                   reader.readAsDataURL(input.files[0]);
                   }
}
</script>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
<script src="http://goo.gl/r57ze"></script>
<![endif]-->
</head>
<body>
<input type='file' onChange="readURL(this);" />
<img id="blah" src="#" alt="Image Name" width="10" height="10" />
</body>
</html>


this is the submit box

<form action="file.php" method="post" >
  <input type="hidden" id="name"  value="<?php echo reader ?>" />
<input type="submit" name="Submit" value="Submit">

Java还是JavaScript?你应该下定决心。请解释一下你想做什么,因为这毫无意义。您是否正在尝试将图像上载到php脚本?您是否正在尝试上载图像并将其显示在img标签中?你的表格在哪里?请不要混淆java和javascript。您的表单中没有文件输入?您还需要一个multipart属性用于文件上载您需要一个表单标记。