我希望能够将我的Windows Phone 8应用程序中的图像上传到我的网站。
为此,我遵循了本网站的教程: https://vortexwolf.wordpress.com/2013/06/04/windows-phone-select-and-upload-image-to-a-website-over-http-post/
这一切都很好,在Windows手机应用程序方面。但我的网站upload.php文件工作有问题。在该教程中,作者使用http://posttestserver.com/post.php?dir=wp7posttest来获取上传的响应。在我的情况下,使用该URL进行测试工作正常,但是当我将我的网站网址设置为时,我得不到响应,并且在visual studio中出现崩溃,并出现以下错误:
Additional information: The remote server returned an error: NotFound.
此行发生此错误:
response = (HttpWebResponse)request.EndGetResponse(asynchronousResult);
我网站上的upload.php如下所示:
if(isset($_GET['dir']))
{
$dir = $_GET['dir'];
if($_FILES['photo']['name'])
{
if(!$_FILES['photo']['error'])
{
$new_file_name = strtolower($_FILES['photo']['tmp_name']);
if($_FILES['photo']['size'] > (1024000))
{
$valid_file = false;
$message = 'Oops! Your file\'s size is to large.';
}
if($valid_file)
{
move_uploaded_file($_FILES['photo']['tmp_name'], '../$dir/' . $new_file_name);
$message = 'Congratulations! Your file was accepted.';
}
}
else
{
$message = 'Ooops! Your upload triggered the following error: '.$_FILES['photo']['error'];
}
}
echo $message;
}
我没有想法,并且第二天坚持这个问题。有关如何使网站upload.php文件正常工作的任何答案/想法?
谢谢!