[英]Passing filename from Java to PHP using HTTP URL
I want to upload my file from Java using SFTP and upload the file path with PHP script but the problem is I am not getting the path in my PHP script say in a textbox but in my IDE the path is showing 我想使用SFTP从Java上传文件,并使用PHP脚本上传文件路径,但是问题是我没有在文本框中说出我的PHP脚本中的路径,但是在我的IDE中却显示了该路径
Uploading directly using SFTP is fine but the path of the file is not displaying in my PHP textbox* 使用SFTP直接上传可以,但是文件的路径未显示在我的PHP文本框中*
JAVA code JAVA代码
BufferedReader in;
boolean blResult = sftpBean.connect("xx.xxx.xx.x", xx, "xxxx", "xxxx");
if (blResult) {
System.out.println("Successfull Connection");
String path="/home/folder/upload/";
String p="http://xx.xxx.xx.x/upload/";
blResult = sftpBean.uploadFile(data,result,path);
if(blResult) {
OutputStream os = null;
InputStream is = null;
URL url = new URL("http://xx.xxx.xx.x/folder/test.php?test="+p+result);
URLConnection conn = url.openConnection();
conn.connect();
in = new BufferedReader(newInputStreamReader(conn.getInputStream()));
String inputLine;
while((inputLine = in.readLine()) != null) {
System.out.println(inputLine);
}
in.close();
PHP CODE test.php PHP代码 test.php
<?php
$path=$_GET['test'];
echo "<input type='text' value='$path'>";
?>
The expected result would be the path name will display in my php textbox So far the results display only in my IDE 预期的结果是路径名将显示在我的php文本框中,到目前为止,结果仅显示在我的IDE中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.