将文件发送到服务器时,PHP$\文件为空
我想用来上传文件。我正在尝试使用将文件发送到服务器时,PHP$\文件为空,php,angularjs,file,upload,Php,Angularjs,File,Upload,我想用来上传文件。我正在尝试使用$\u FILES全局数组捕获上载的文件。当文件内容被发送到服务器时,PHP似乎无法捕获上传的文件元数据(文件名等)。所以$\u文件是空的。顺便说一下,奇怪的是我竟然将文件和数据属性都设置为file $scope.upload = function (files) { if (files != null && files[0]) { var file = files[0]; c
$\u FILES
全局数组捕获上载的文件。当文件内容被发送到服务器时,PHP似乎无法捕获上传的文件元数据(文件名等)。所以$\u文件是空的。顺便说一下,奇怪的是我竟然将文件和数据属性都设置为file
$scope.upload = function (files) {
if (files != null && files[0]) {
var file = files[0];
console.log(file);
file.upload = Upload.http({
url: 'rest/file/',
data:file,
fileName:'test',
file: file
});
file.upload.then(function (response) {
file.result = response.data;
}, function (response) {
if (response.status > 0)
$scope.errorMsg = response.status + ': ' + response.data;
});
file.upload.progress(function (evt) {
file.progress = Math.min(100, parseInt(100.0 * evt.loaded / evt.total));
});
}
}
HTML标记:
<p>
<label for="background">Background</label>
<input ngf-select ngf-change="upload($files)" accept="image/*"
ng-model="form.background"
name="background" type="file"/>
<img ng-show="form.background[0] != null" ngf-thumbnail="form.background[0]" class="thumb"/>
<span class="meter" ng-show="form.background[0].progress >= 0">
<span style="width:{{form.background[0].progress}}%"
ng-bind="form.background[0].progress + '%'"
class="ng-binding">
</span>
</span>
</p>
出身背景
检查php.ini中的file\u uploads=On、post\u max\u size和upload\u max\u file\u size。另外,请尝试增加php.ini中的内存限制。hi@phpst,您找到了解决方法吗?我不记得了。我搬到了