第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

服務(wù)器跟客戶端都報(bào)錯(cuò)

服務(wù)器:

??? public String uploadInfo() throws IOException{
?? ??? ?
?? ??? ?System.out.println(username + "," +password);
?? ??? ?
?? ??? ?if(mPhoto == null){
?? ??? ??? ?System.out.println(mPhotoFileName + "is null .");
?? ??? ?}

?? ??? ?String dir = ServletActionContext.getServletContext().getRealPath("files");
?? ??? ?
?? ??? ?File file = new File(dir,mPhotoFileName);
?? ??? ?
?? ??? ?FileUtils.copyFile(mPhoto,file);//上傳文件
?? ??? ?
?? ??? ?return null;
?? ?}


ERROR org.apache.struts2.dispatcher.Dispatcher - Could not find action or result
/imooc_okhttp/uploadInfo

https://img1.sycdn.imooc.com//5b8411100001290a15940826.jpg


客戶端:

????public?void?doUpload(View?view)?throws?IOException?{
????
????????File?file?=?new?File(Environment.getExternalStorageDirectory(),"temp.jpg");
????????if?(!file.exists()){
????????????L.e(file.getAbsolutePath()+"not?exist!");
????????????return;
????????}
?????????RequestBody?requestBody?=?new?MultipartBody.Builder()
????????????????.setType(MultipartBody.FORM)
????????????????.addFormDataPart("username","hyman")
????????????????.addFormDataPart("password","1234")
????????????????.addFormDataPart("mPhoto","temp.jpg",RequestBody.create(MediaType.parse("application/octet-stream"),file))
????????????????.build();
????????Request?request?=?new?Request.Builder()
????????????????.url(BaseUrl+"uploadInfo")
????????????????.post(requestBody)
????????????????.build();
????????????????
????????executeRequest(request);
????}

點(diǎn)擊按鈕之后是html的文檔

https://img1.sycdn.imooc.com//5b84114400018ef216010776.jpg

正在回答

1 回答

原因是上傳的圖片太大,看了同學(xué)們的評(píng)論,原來(lái)需要在在structs.xml中加一句:

<constant name="struts.multipart.maxSize" value="9000000"/>

9000000是文件大小的限制

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

服務(wù)器跟客戶端都報(bào)錯(cuò)

我要回答 關(guān)注問(wèn)題
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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