Problem saving a file with OpenOutput

cgalvizu

Member
Licensed User
Longtime User
Dear all:
I am having a problem and require your help:

I am trying to download a file and save it in the sd card (directly connected to the devive via USB):

DownloadService.Target = File.OpenOutput(DummyVar , fileName, False)

where
newConfigurationID = "2"
DummyVar = File.DirRootExternal& "/" & newConfigurationID

I am getting the error:
java.io.FileNotFoundException: mnt/sdcard/2/epc.mp4 (Invalid Argument)

previously I created that directory with:
File.MakeDir(File.DirRootExternal , newConfigurationID)

any suggestions?
 

cgalvizu

Member
Licensed User
Longtime User
Invalid Argument in OpenOutput

Thanks Erel for your response.
In fact if I change the second argument in OpenOutput for a constant instead of a variable it works fine.

Any sugestions?
 
Upvote 0

cgalvizu

Member
Licensed User
Longtime User
Problem with the second argument in OpenOutput

Anybody has an idea why I am getting InvalidArgument when I use a variable in the filename of OpenOutput?

If I use the name of the file
File.OpenOutput( File.DirRootExternal,"image.png",False) it works fine

If I use a variable with the name of the file
File.OpenOutput( File.DirRootExternal,filename,False) it doesnt work!

Thanks in advance.
 
Upvote 0

Similar Threads

Replies
10
Views
1K
  • Locked
  • Article
Android Code Snippet [B4X] DownloadAndSave
Replies
2
Views
8K
Replies
36
Views
103K
  • Article
Android Code Snippet [B4X] Bytes To File
Replies
28
Views
52K
Top