我有一個託管在jelastic.com上的Web應用程序。我通過使用路徑/opt/glassfish3/temp
將圖像上傳到服務器的主目錄。代碼如下:如何訪問存儲在服務器上的圖像
FileOutputStream fos = new FileOutputStream("/opt/glassfish3/temp/" + fileName);
fos.write(uploadedFile.getContents());
fos.flush();
fos.close();
我正在使用圖像標記來顯示圖像文件,但它給了我一個破碎的圖像。 html代碼如下:
<img src="/opt/glassfish3/temp/${sessionScope['userdet']['image']}" width="200px" ></img>
你能解決這個問題?我有同樣的問題 – sergioBertolazzo 2017-10-10 22:59:34