Frage

I haved created the folder , code like that

 var file = Components.classes["@mozilla.org/file/local;1"]
         .createInstance(Components.interfaces.nsILocalFile);



 var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"]
             .createInstance(Components.interfaces.nsIFileOutputStream);
 filePath = path;
 file.initWithPath(filePath);
 if(file.exists() == false ) {
   file.create(0x01, 0644); 
 }

but when I create the file in the folder , there is a error show like that

Error: uncaught exception:

[Exception... "Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsILocalFile.create]"  nsresult: "0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)"

anyone can help me please?

War es hilfreich?

Lösung

Change the directory permissions to 0755

Andere Tipps

That error is usually due to file or directory permissions. You might want to take a look at the code examples here.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top