[英]Can't upload file in java spring boot to the tomcat hosting server, always show access denined for the given file upload path in fedora
如果有機會,我需要幫助。 我很久以前對tomcat並不熟悉,部署了java war文件。現在我遇到了“文件訪問拒絕:...”的問題,該問題始終登錄到托管服務器。 要點是,我無法上傳到托管服務器,並且對於該部分,我始終會收到“訪問被拒絕”的異常
String path=System.getProperty("user.home")+"/UploadFiles/";
try {
byte[] bytes = file.getBytes();
Path path = Paths.get(p+ "img.jpg");
Files.write(path, bytes);
} catch (Exception e) {
System.out.println(e);
}
謝謝。
檢查您的Tomcat進程是否可以寫入指向path
任何地方。 [...]/UploadFiles/
最有可能是權限問題,JVM進程無法寫入[...]/UploadFiles/
目錄。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.