Execute PHP Upload From VB.NET
| From: | Wei, Alice J. | Date: | Mon, 23 Jun 2008 18:13:34 +0000 |
| Subject: | Execute PHP Upload From VB.NET | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-28957@lists.php.net to get a copy of this message | ||
Hi,
I am wondering if anyone on the list has tried to use VB.NET to execute a PHP a script. I have
made attempts of using the following code from the browser like Firefox, which works, but when I try
to use a VB.NET to execute the following script, I get the error every time at the else statement at
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) telling me that
there is an error with the file even though I am only uploading a 2kb text file.
//Create a upload File
if ($directory =='') {
echo "<p>Sorry, I don't understand which file you are uploading. Did you choose a
file?</p>";
exit();
}
$filename="C:/Inetpub/wwwroot/test";
if (file_exists($filename)) {
//Don't display anything
}
else {
echo "<p>Sorry, the specified patient directory does not exist.</p>";
}
$target = "test/" . basename( $_FILES['uploaded']['name']) ;
$ok=1;
//Here we check that $ok was not set to 0 by an error
if ($ok=='0') {
echo "<p>Sorry your file was not uploaded.</p>";
}
//If everything is ok we try to upload it
else {
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) {
echo "<p>The file ". basename( $_FILES['uploaded']['name']).
" has been uploaded.</p>";
$file= $_FILES['uploaded']['name'];
list($name,$ext) = split('[/.]',$file);
echo "<p>Contour Name: " . $name . " </p><p>File Extension: "
. $ext . ".</p>";
echo "<p>Thanks for using the system!</p>";
}
else {
echo "<p>Sorry, there was a problem uploading your file.</p>";
}
}
Could there be something I have missed in my PHP to allow a VB.NET code to interact with the above
code?
Thanks to anyone who may help.
Alice
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
ajwei@indiana.edu