java - Azure web app write and read files -


i have made simple java web app runs on tomcat explore azure environment.

i can read files (deployed via ftp web app's root) web app, in path denoted home environment variable (azure's own env variable, resolves d:\home):

string home = env.getproperty("home");  fileinputstream fis; try {     fis = new fileinputstream(home + "/" + "input.txt");      //...      fis.close(); } catch (ioexception e) {     //... } 

but can't write files same path:

string home = env.getproperty("home"); file file = new file(home + "/output.txt");  try {     fileoutputstream fos = new fileoutputstream(file, true);      //...      fos.flush();     fos.close(); } catch (ioexception e) { //access denied     return "error :" + e.getmessage(); } 

above code fails access denied error.

can write persistent files path in azure, or need cloud native storage this?

you cannot create files directly under %home%, can created directories. , in there, can create files. it's files @ root disallowed.


Comments