When browsing files for upload how to make the browser to look into a specific folder always?
I have to upload the images.
when browsing images for the same I am making firefox to look into E/Folder1/A1.
E contains Folder1
Folder contains folders A1, A2, A3, and so on.
Each folder contains each image.
After uploading the image from A1, I have to upload the image from A2,
When I browse for the same, firefox will look into the recently used folder.
I do not want this. Instead firefox should look into E/Folder1 by default always and not into E/Folder1/A1
How to do this?
Όλες οι απαντήσεις (20)
Reference:
https://groups.google.com/forum/#!topic/mozilla.dev.apps.firefox/ExaF8Jhl3mY
The coding for that can be seen here:
http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js
You should be able to "lock" the value of that pref to that one location by using a user.js file in your Profile folder.
The preference that you want to "lock" is browser.open.lastDir
Put this code in your new user.js file.
user_pref("browser.open.lastDir", "D:\\");
Change the D:\\ to the "path-to" the folder that you want to always open when you "Browse".
Or you can just Modify that pref in about:config, but I advocate using the user.js method so the user can keep better track of their customized prefs and make it a hell of a lot easier to create additional Profiles in the future, rather than trying to remember all the changes they made in about:config. That file is "portable"; it can be copied from Profile to Profile without even having to mess around with the hundreds of advanced prefs in about:config. (I'm using the user.js file that I first created in Firefox 0.8, in 2004.)
Τροποποιήθηκε στις
Thank you for your reply.
I had created user.js file and entered the code as you said.
How should I lock this pref? Please update.
Because after I did as you said, still the issue persists.
I used lockPref. But the lock was not applied. Please update me the reason for the same.
That code effectively locks the pref.
Are you sure your user.js file is in the correct folder?
Yes lock was applied. I missed the quotes in local-settings file.
But still when I browse the file, the firefox is looking into the last used folder and not to the folder that I locked.
Please update.
I am using the exact code that I posted and it works for me. I can see that pref in the prefs.js file. Please note that I struck-out my comment about changing that pref thru about:config - that doesn't work, a mind-fart at my end.
Please post the exact code that you used.
Also, if you edit the code in the user.js file while Firefox is running, you need to restart Firefox in order that the change takes place. If that pref doesn't appear in the prefs.js file, there is an error in the code - the formatting of that pref has to be exact, or Firefox will stop reading the user.js file every time Firefox is launched. Forgetting the double back-slash is the easiest mistake to make when doing "path-to" in a user.js pref.
I am aware of double back-slash. :)
User.js file contain the following code
user_pref("browser.open.lastDir", "E:\\kan\\725 Images 102161 431653");
Same code updated automatically in prefs.js file as well.
mozilla.cfg file contains the following code
// lockPref("browser.open.lastDir", "E:\\kan\\725 Images 102161 431653");
local-settings.js contains the following code
pref("general.config.obscure_value", 0); pref("general.config.filename", "mozilla.cfg");
Status is locked for this pref.
Noticed one thing. Locked pref is not showing in prefs.js file.
When the pref is unlocked it appears in prefs.js file.
This is automatic.
Still I am not able to make firefox to look into specific location always. All files were there in their correspective folders.
User.js and prefs.js in profile folder
mozilla.cfg in installed folder local-settings.js in default/prefs folder.
Please update.
// lockPref("browser.open.lastDir", "E:\\kan\\725 Images 102161 431653");
please note that this in two lines as below.
// lockPref("browser.open.lastDir", "E:\\kan\\725 Images 102161 431653");
when I am posting this is converting into single line.
attaching screen shot for your reference.
Sorry, I am not familiar with using the mozilla.cfg file.
Don't use spaces in the "path-to" in user.js prefs.
Try using something like this:
user_pref("browser.open.lastDir", "E:\\kan\\725_Images_102161_431653\\");
With an underscore (or maybe a hyphen) instead of a space in the "path-to".
edit: added double back-slashes to the end of the folder name
Τροποποιήθηκε στις
Underscore is not an issue. Because I have spaces in the folder name for download. There it is working for download.
However I did as you said. Still no result.
Mozilla.cfg is used for locking the preferences. Cfg - configuration file
http://kb.mozillazine.org/Locking_preferences
The above link will explain about locking preferences.
Please update :)
See my edit to the "path-to". If that is a folder the path needs to indicate so with a double back-slash on closing. Sorry for that oversight.
I had copy pasted your code and tried. Still no result.
Please update
If it is working on your end, please update me with step-by-step process that you did.
Please note that I am using windows xp 32 bit.
Thanks
Setting a pref via the user.js only resets the pref when Firefox is started and still allows to make changes to this pref during the current session.
Easiest is to copy the line as it appears in the prefs.js file to the user.js file if you want to use this file.
Locking the pref with a mozilla.cfg file locks the pref against changes (you see the locked status on the about:config page), but I don't know if this also effects the default upload location.
Hi Cor-el
As per the advise from the-edmeister I did these. Ultimately what I am expecting is not yet resolved.
Please help me out if you have an idea of how to make the default upload location. The-edmeister also helping me a lot to resolve the issue.
If I can get this done, it saves 45% of my time. I am uploading 2500 images for a client. each image in each folder :)
using up one level for each folder will consume time by 2500 times.
Please update.
Prefs.js file does not had the pref provided by the-edmeister. Also not there in about:config, until I added manually to user.js
Prefs.js had been updated from user.js for the pref browser.open.lastDir
Hi shabukumar,
Have you found a solution? user.js doesn't work for me either.
Thanks.
There is no pref setting for the default upload location. Firefox may be using the last used download location or the default download location or some location stored in the content-prefs.sqlite file and part of the site preferences.