如何在Visual Basic 2010 Express上传文件和接收响应? [英] How do I upload file and receive response on Visual Basic 2010 Express?

查看:75
本文介绍了如何在Visual Basic 2010 Express上传文件和接收响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的A-Level项目,我必须使用VB,我并不为此感到自豪。



无论如何,我知道如何将文件上传到用于将文件存储到Web服务器的PHP脚本,PHP脚本生成唯一的文件名。我想在VB中使用PHP脚本的响应,有点像读取响应。我的代码是:



Visual Basic:

For my A-Level project, I have to use VB and I am not proud of it.

Anyway, I know how to upload a file to a PHP script to store files to a webserver, and the PHP script generates a unique file name. I want to then use the response from the PHP script with VB, sort of like reading the response. My codes are:

Visual Basic:

Sub uploadfile()
    For Each fPath In FilePath
        My.Computer.Network.UploadFile(fPath, "http://mydomain.com/upload.php")
        MsgBox(fPath)
    Next

End Sub





PHP:



PHP:

<?php
$temp = explode(".", $_FILES["file"]["name"]);
$extension = end($temp);
if ($_FILES["file"]["error"] > 0){
    echo "Error";
}else{
    $newfile = uniqid("image_").".".$extension;
    move_uploaded_file($_FILES["file"]["tmp_name"], "Images/" . $newfile);
}
?>

推荐答案

temp = explode(


_FILES [ file] [ name]);
_FILES["file"]["name"]);


extension = end(
extension = end(


这篇关于如何在Visual Basic 2010 Express上传文件和接收响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆