BackgroundUploader 示例在使用 PHP 的 Apache 服务器上不起作用 [英] BackgroundUploader Sample does not work on Apache Server with PHP
问题描述
我必须从 Windows Phone 8.1 应用程序上传视频文件.我正在使用 BackgroundTrasfer 示例,但用于服务器端只是一个aspx脚本.但我需要 PHP.
I have to upload a video file from an windows phone 8.1 app. I am using the BackgroundTrasfer sample but for the server side there is just a aspx script. But I need PHP.
我找到了这个 PHP 脚本
I have found this PHP script
<?php
$target = "upload/";
$target = $target . basename( $_FILES['Filename']['name']) ;
$ok=1;
if(move_uploaded_file($_FILES['Filename']['tmp_name'], $target)) {
echo "The file ". basename( $_FILES['Filename']['name']). " has been uploaded";
} else {
echo "Sorry, there was a problem uploading your file.";
}
?>
最后我得到 200 并且没有错误,但是服务器上没有文件,所以我会说服务器部分有问题吗?在哪里可以获得工作服务器部分脚本?
Finally I get a 200 and no errors but there is no file on the server so I would say the server part is the problem? Where I can get a working server part script?
附言目录upload"与upload.php存在于同一目录下,权限为777.
P.S. The directory "upload" exist in the same directory like the upload.php and has the rights 777.
推荐答案
你需要做一个 multipart/form-data
请求.
You need to do a multipart/form-data
request.
尝试类似(伪代码):
List<BackgroundTransferContentPart> parts =
new List<BackgroundTransferContentPart>();
var part = new BackgroundTransferContentPart("myFile");
part.SetFile(file);
parts.Add(part);
UploadOperation upload = await uploader.CreateUploadAsync(
uri,
parts);
var task = upload.StartAsycn().AsTask();
在 PHP 上,使用 print_r($_FILES)
浏览接收到的文件.
On PHP, explore the recevied files with print_r($_FILES)
.
这篇关于BackgroundUploader 示例在使用 PHP 的 Apache 服务器上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!