最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

關(guān)于在angularJS中進(jìn)行文件上傳時(shí)路徑問(wèn)題

關(guān)于在angularJS中進(jìn)行文件上傳時(shí)路徑問(wèn)題

愛(ài)上瘋狂 2016-01-28 15:16:52
想請(qǐng)教一下大家,關(guān)于在angularJs中進(jìn)行文件上傳時(shí),上傳路徑該如何定義?比如看到網(wǎng)上有個(gè)例子如下:.directive.js中.controller('myCtrl', ['$scope', 'fileUpload', function($scope, fileUpload){?? ???? $scope.uploadFile = function(){?? ??? ??? ?debugger;?? ???????? var file = $scope.myFile;?? ???????? console.log('file is ' );?? ???????? console.dir(file);?? ???????? var uploadUrl = "/file";?? ???????? debugger;?? ???????? fileUpload.uploadFileToUrl(file, uploadUrl);?? ???????? debugger;?? ???? };?? ??? ??? ?}]);.service.js中.factory('fileUpload', ['$http', function ($http) {?? ??? ???? var uploadFileToUrl = function(file, uploadUrl){?? ??? ???????? var fd = new FormData();?? ??? ???????? fd.append('file', file);?? ??? ???????? debugger;?? ??? ???????? $http.post(uploadUrl, fd, {?? ??? ???????????? transformRequest: angular.identity,?? ??? ???????????? headers: {'Content-Type': undefined}?? ??? ???????? })?? ??? ???????? .success(function(){?? ??? ??????? ??? ?alert("圖片上傳成功!");?? ??? ???????? })?? ??? ???????? .error(function(){?? ??? ??????? ??? ?alert("error,圖片上傳失??!");?? ??? ???????? });?? ??? ???? };?? ??? ??? ??? ??? ???? return {?? ??? ??? ??? ?uploadFileToUrl : uploadFileToUrl ?? ??? ???? };?? ??? ?}]);項(xiàng)目首頁(yè)請(qǐng)求地址是localhost:3000,但是項(xiàng)目的真實(shí)port是8080。那保存文件的路徑/file是在哪里?
查看完整描述

1 回答

?
pardon110

TA貢獻(xiàn)1038條經(jīng)驗(yàn) 獲得超227個(gè)贊

網(wǎng)站根目錄下的/file

查看完整回答
反對(duì) 回復(fù) 2016-01-28
  • 愛(ài)上瘋狂
    愛(ài)上瘋狂
    可是我在網(wǎng)站根目錄下的file文件夾里并沒(méi)發(fā)現(xiàn)上傳的文件。
  • 1 回答
  • 0 關(guān)注
  • 6867 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)