Dの場合:\ \ファイル\フォルダは、エラーが存在しない場合をアップロード
文字列strPath = "D:\\アップロード\\ファイル\\ 2.mp3" 。 ファイルファイル = 新しいファイル(strPath); もし(!file.exists())){ file.createNewFile(); }
以下は、フォルダDが作成されます:\\アップロード\\ファイル\\ 2.mp3を\
文字列strPath = "D:\\アップロード\\ファイル\\ 2.mp3" 。 ファイルファイル = 新しいファイル(strPath); もし(!file.exists())){ file.file.mkdirs(); }
このコードは正常にファイルを作成することができます
文字列strPath = "D:\\アップロード\\ファイル\\ 2.mp3" 。 ファイルファイル = 新しいファイル(strPath); ファイルfileParent = file.getParentFile(); もし(!fileParent.exists()){ fileParent.mkdirs(); } file.createNewFile()。