gpt4 book ai didi

java - 如何寻址我的 java 项目中的文件夹?

转载 作者:行者123 更新时间:2023-12-02 05:44:51 24 4
gpt4 key购买 nike

我想上传源项目中的图片。当我在桌面上寻址但我不知道如何在我的源代码中寻址时它可以工作

for(FileItem item : items){                        
File upDir = new File("/SliderManagment2/uppic");
File file = File.createTempFile("img", ".png" , upDir);
item.write(file);
}

最佳答案

根据documentation :

For Microsoft Windows platforms, the prefix of a pathname that contains a drive specifier consists of the drive letter followed by ":" and possibly followed by "\" if the pathname is absolute. The prefix of a UNC pathname is "\\"; the hostname and the share name are the first two names in the name sequence. A relative pathname that does not specify a drive has no prefix.

关于java - 如何寻址我的 java 项目中的文件夹?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56105719/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com