I'm trying to open Chrome's Preferences file, a JSON text file in Chrome's folder on a Windows installation.
The thing is that I need to know the username to get the actual path.
Is there a way to acces a file in the user's folders tree without prompting for it, and without running any out of browser code?
I tried to use file:// protocol to access a relative path, but it seems file:// relative paths don't work on Windows.
Thank you
Related
Bit of a loose question so if it gets marked down I'll remove it.. but..
I'm using Primefaces/Spring/Hibernate for Java server.
My application knows a load of file names I need to upload. Those files are on my local computer. Is it possible to tell the application the root directory of these files, for it to then setup uploads for each of these files without me needing to browse for each file individually?
I assume this is a browser security issue, i.e. the user needs to explicitly state which file the application is allowed to know about etc?
If not I'll have to do it in a local application but I was hoping there was a way a mass upload could be kicked off from the browser by just setting the local directory of the files.
I decided to use the Primefaces uploader, upload all the files in the directory and let the application sort them out once it has them on the server.
I'm making a chrome extension for the first time.
For my extension, I want it can automatically download images to its extension folder. For example, if the extension folder is /xxxx/abc/, I want it can download images to /xxxx/abc/image/.
To make it, I don't know how to write file/ download image to this directory. I don't want users notice this.
I found an extension can make it. It's called Momentum. It can download images to /xxxx/<extension root dir>/backgrounds/.
Can anybody tell me what technique do I need? Thanks a lot!
No, you can't. An extension has only read-only access to own files.
Instead, you can download to a virtual HTML5 filesystem and use files from it. See this tutorial - the big red warning means no other browser uses this technology, but Chrome does.
You may want to declare "unlimitedStorage" permission to make sure you have the space to store the files.
This being a virtual filesystem, those won't actually be files you can open on your disk. If you need to give files to the user afterward, you can use chrome.downloads to write them to the downloads folder, but that's "write-only", you can't access the contents afterwards.
I usually use "TAB" button to help me do typing in linux or AIX command, for example, I have a file with file name is abcdefg.txt, so when I want to vi to this file, I just type vi ab then press the "TAB" button in my keyboard, then it will automatically help me search for abcdefg.txt (only have 1 file which is name start with ab).
However, when I ftp to the environment, I can not use "TAB" button, I need to fully type the whole file name. Please advise me how to do this in ftp environment.
Second problem, in ftp environment, when I list all the files in the directory, I saw a file which name is 123456789.txt, however, when I want to rename it like:
rename 123456789.txt 123456789a.txt
it prompt me 550 123456789.txt: A file or directory in the path name does not exist.
But I can rename the other files. I suspect this 123456789.txt file name got some space in some where, that's why I hit the error.
Most FTP programs, especially those which come with proprietary Unices like AIX or HP-UX don't offer readline support. Install a more powerful tool like ncftp to fix this.
To rename files with whitespace, you can try to quote the file name but again, this might fail with bare-bones FTP clients.
When just downloading the file, there is a simple workaround: Use your browser. Every browser supports the ftp:// protocol. The main problem here is security: You have to pass the password via the URL: ftp://user:password#host/ so the browser will put it into its history.
But since you use FTP, security isn't a concern anyway (FTP transmits the password as plain text over the wire, so everyone on the same network can see it).
Another option is mucommander, a cross platform file manager which supports a wide range of protocols and which handles spaces in file names correctly.
On my webpage, I have placed a link to a local file (e.g. "text.docx" on my local HD). I would like to double click on this link, and have a third party software which is installed locally on my PC (e.g. Microsoft Word) open it.
I would like to be able to do this with Firefox and Google Chrome. Obviously, I am a newbie to web programming.. can somebody show me the way? I have looked around and had the impression that I need to write and add an extension, maybe?
Thanks for your time. Jakob
This is only possible if you know either the absolute path to the file or the relative path from whatever working directory your browser runs from. You the create a link with
href="file://relative/path/to/file/text.docx"
or
href="file:///absolute/path/to/file/text.docx"
and any modern browser will query the system database for the mimetype of the file depending on its extension, thus prompting to open the correct application.
EDIT
I inawarently introduced a unixism in the previous code: Distinction bewteen absolute and realtive paths as above works well on current *nix desktops, but in Windows an absolute path will most likely look like
href="file://C:/drive/absolute/path/to/test.docx"
Mind the 2 (not 3) slashes a the beginning, and the forward (not backward) slashes.
As far as I know, you can't link to local files from a website. If you upload it to where your files are, you could then be able to download it.
I was able to execute code locally, using Firefox, by adding an extension which used the XPCOM interface. One such extension was "commandrun", and may be found here: https://github.com/aabeling/commandrun .
So, I decided to try to break my website...I googled my site by typing in site:mysite.com/whatever and behold, all of the users uploaded files were available for view under a specific directory.
What kind of script/ counter measure should I use to block these files from being viewed? I already have a script that checks the path and the logged in status, however this doesn't seem to be working. I've looked all over for solutions...but I can't quite find one. I'm using ColdFusion 8.
This isn't a ColdFusion issue so much as a web server configuration issue.
You should either:
configure your web server not to show a directory of files when using a URL without a filename (e.g., http://www.example.com/files/)
drop a blank default web document (index.html, index.htm, default.htm, index.cfm, whatever) into that directory so that it displays that document rather than the list of files. If you use index.cfm, it'll fire your Application.cfm/cfc in your file path and use whatever other security you've built.
(or, better, do both)
The best way to secure your file listings and the files themselves is to store them in another folder outside of the Web site root folder. You can then serve them up using CFDIRECTORY and CFCONTENT. The pages that display the files can check your access controls and only serve the files to those allowed to see them.