I can access and play file named "Song.mp3" located in the root directory of my project but when I put it into "assets" directory I got error.
Here is my project directory:
- Test
-- src
--- Homeview.mxml
-- assets
--- Song.mp3
-- Song.mp3
I can access and play Song.mp3 located in the root folder but I get error when I want to play assets/Song.mp3.
This works:
var req:URLRequest = new URLRequest('../Song.mp3');
This does not:
var req:URLRequest = new URLRequest('../assets/Song.mp3');
I get following Runtime error:
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: app:/assets/Song.mp3
I think that Song.mp3 in the root directory get exported in the final swf file but assets/Song.mp3 does not. If that is the case is there a way to force Flex to export assets/Song.mp3?
You can use file class i.e. File.applicationStorageDirectory.resolvepath("your url")
or File.applicationDirectory.resolvepath("your url").Store it in File type variable;use the file.url or file.nativePath to access the file.
This will be able to retrieve your external file which is there in the applicaton folder.
Related
the error: WinRT originate error-0x80070057:'The specified path (msappx:\Local\C:\Windows\Web\Screen\img103.png) is not an absolute path, and relative paths are not allowed. '
when I used C++/WinRT,the function call is
winrt::Windows::Foundation::IAsyncOperationwinrt::Windows::Storage::StorageFile temp = StorageFile::GetFileFromPathAsync(hFilname);
what can I do?
For StorageFile.GetFileFromPathAsync() method, you don't have permission to access the specified file, please see here.
My suggestion is that you could store the image file in Application install directory that app can access, then use the following code to access it.
StorageFolder folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
string path= Path.Combine(folder.Path, #"Data\img1.png");
StorageFile.GetFileFromPathAsync(path);
Note that the Application install directory is ..ProjectPath\bin\x86\Debug\Appx
I'm running meteor on a codeanywhere container.
I want to read a file with fs (I have another container with node+express and I can use it fine there). The file is located next to the main.js script in the server folder.
In the main.js I'm trying to do this:
console.log(process.cwd());
console.log(path.resolve(__dirname));
let filePath = path.join(__dirname,"History.txt")
console.log(filePath);
let value = fs.readFileSync(filePath, 'utf8');
I've tried the simple History.txt, ./History.txt, to run it with the full result of process.cwd, from the public folder... but all I get is:
Error: ENOENT: no such file or directory, open '/server/History.txt'
process.cwd is:
/home/cabox/workspace/anaplus/.meteor/local/build/programs/server
__dirnam is:
/server
I cannot see what's wrong here
Put it in a top-level folder named private then it will be available under .meteor/local/build/programs/server/assets/app and you can then also obtain it using Assets: https://docs.meteor.com/api/assets.html
I know how to copy a file in sftp server. But, how to put files in a sftp folder to a suitescript array? Also, is it possible to move or delete a file in sftp server using suite script 2.0? If yes, how to do it?
The following coding is for copying a file in sftp:
var myPwdGuid = "B34672495064525E5D65032D63B52301";
var myHostKey = "AAA1234567890Q=";
var connection = sftp.createConnection({
username: 'myuser',
passwordGuid: myPwdGuid,
url: 'host.somewhere.com',
directory: 'myuser/wheres/my/file',
hostKey: myHostKey
});
var downloadedFile = connection.download({
directory: 'relative/path/to/file',
filename: 'downloadMe.js'
});
connection.upload({
directory: 'relative/path/to/remote/dir',
filename: 'copy_of_downloadme.js',
file: downloadedFile,
replaceExisting: true
});
Indeed, the SFTP module in its current version does not include a way to list the contents of a remote directory. In some scenarios the file name is known or predictable. For the other scenarios one can use a file with a known name to store the names of the other files or middleware to retrieve the list of files. Ask me if you want to know about an existing middleware solution.
I am using the Jsoup jar file in my Coldfusion application. I was originally storing it in a local lib folder, but for security purposes we decided to store it in the cfroot lib folder. I uploaded the jar to the /lib folder in root, and added this code to Application.cfc:
this.javaSettings = {
loadPaths: [
"./lib/"
],
loadColdFusionClassPath: true
};
However, my code (that was working before) now generates the following error:
ERROR
Object Instantiation Exception.
Class not found: org.jsoup.JsoupObject Instantiation Exception.
...
It seems the code is not finding/loading the jar file. How can I point the code towards the Jsoup jar file stored in root?
Try backslash instead of forward-slash,
this.javaSettings = {
loadPaths: [
".\lib\"
],
loadColdFusionClassPath: true
};
I am using input tag type="file" to browse the file in asp.net.
I browsed the file "Linq2sql.zip" from the location "c\Desktop\Karthik\Linq2sql.zip".
i can get the file name and path using
HttpPostedFileBase file;
var filePath = Path.GetFullPath(file.FileName);
But File path is like = C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\DevServer\\10.0\\Linq2sql.zip
i have to get the original file path c\\Desktop\\Karthik\\Linq2sql.zip. How can i get?
You can not get the original path of the file on the client system; that information is not sent by the client.
The reason you get what you do with GetFullPath is because that forces a resolution with the simple file name alone with the current directory of the asp.net process. That info is utterly meaningless - and in fact incorrect - in this case.