我遇到了文件对象的有趣问题,这里是详细信息
文件(C:\ Users \ raj \ Desktop \ xyz.zip)正从windows系统上传到linux weblogic服务器。
在服务器端,创建文件对象的绝对路径,并通过调用fileObj.getName()来获取文件名,以在临时位置创建文件夹以执行操作。
fileObj.getName()在生产环境中的linux服务器中返回绝对路径路径(C:\ Users \ raj \ Desktop \ xyz.zip),但奇怪的是当我们在我们的测试平台上测试它按预期工作喜欢xyz.zip
有人能让我们知道返回绝对路径的可能原因是什么?
String tmpDir = "/share/folder/linux";
String userSelectedFile = localDeployInterfaceForm.getFileName(); // getting the file absolute name as C:\Users\raj\Desktop\xyz.zip when user uploading to server
File userSelectedFileObj = new File(userSelectedFile); // file object is created to get the file name as xyz.zip
File newTmpFileToCreate = new File(tmpDir, userSelectedFileObj.getName()); // creating temp file as tmpfolder+xyz.zip
/* Get the Absolure path for temprory file */
String newTmpFilePath = newTmpFileToCreate.getAbsolutePath(); // expectation is /share/folder/linux/xyz.zip but actual result is /share/folder/linux/C:\Users\raj\Desktop\xyz.zip
由于 Dhorrairaajj