亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    php swfupload中文亂碼怎么解決

    方法:1、利用“fileName=new String(fileName.getBytes("UTF-8"),"GBK")”語句;2、利用“fileName=URLDecoder.decode(fileName,"UTF-8")”語句。

    php swfupload中文亂碼怎么解決

    本教程操作環(huán)境:windows7系統(tǒng)、PHP7.1版,DELL G3電腦

    SWFUpload中文亂碼問題,在網(wǎng)上搜的帖子,關(guān)于這個(gè)問題的解決方法有很多。

    第一種:fileName= new String(fileName.getBytes("UTF-8"),"GBK");
    用這種方式能解決大部分亂碼,但如果文件名中有特殊字符和標(biāo)點(diǎn)符號(hào)有時(shí)候會(huì)轉(zhuǎn)不過來。

    第二種:我使用的是這種辦法,測試已經(jīng)通過

    /**在設(shè)置時(shí)需要設(shè)置一下上傳事件    *upload_start_handler : UploadStart,    *動(dòng)態(tài)傳參數(shù),解決文件名中文亂碼問題  **/   function uploadStart(file) { 	try { 		/* I don't want to do any file validation or anything,  I'll just update the UI and return true to indicate that the upload should start */ 		var progress = new FileProgress(file, this.customSettings.progressTarget); 		 		//progress.setStatus("Uploading..."); 		progress.setStatus("上傳中..."); 		progress.toggleCancel(true, this); 		this.setPostParams({  			  'fileName':encodeURIComponent(file.name)  			  });  	} 	catch (ex) { 	} 	 	return true; }

    在action中使用

    fileName = URLDecoder.decode(fileName,"UTF-8");

    推薦學(xué)習(xí):《PHP視頻教程》

    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)