X
Tap here to go to the mobile version of the site.

Support Forum

When browsing files for upload how to make the browser to look into a specific folder always?

Posted

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?

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?

Additional System Details

Installed Plug-ins

  • Shockwave Flash 12.0 r0
  • Next Generation Java Plug-in 10.51.2 for Mozilla browsers
  • NPRuntime Script Plug-in Library for Java(TM) Deploy
  • Adobe PDF Plug-In For Firefox and Netscape 11.0.06
  • VLC media player Web Plugin 2.1.0
  • Adobe Shockwave for Director Netscape plug-in, version 12.0.7.148
  • DRM Netscape Network Object
  • Npdsplay dll
  • DRM Store Netscape Plugin

Application

  • User Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0

More Information

the-edmeister
  • Top 25 Contributor
  • Moderator
5411 solutions 40308 answers

Helpful Reply

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.)

Reference: <br /> https://groups.google.com/forum/#!topic/mozilla.dev.apps.firefox/ExaF8Jhl3mY The coding for that can be seen here: <br /> 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 [http://kb.mozillazine.org/User.js_file user.js file] in your Profile folder. <br />The preference that you want to "lock" is '''browser.open.lastDir'''<br />Put this code in your new user.js file.<br /> '''user_pref("browser.open.lastDir", "D:\\");'''<br />Change the '''D:\\''' to the "path-to" the folder that you want to always open when you "Browse". <s>Or you can just Modify that pref in about:config, but</S> 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.)''

Modified by the-edmeister

Question owner

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.

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.

Question owner

Because after I did as you said, still the issue persists.

Because after I did as you said, still the issue persists.

Question owner

I used lockPref. But the lock was not applied. Please update me the reason for the same.

I used lockPref. But the lock was not applied. Please update me the reason for the same.
the-edmeister
  • Top 25 Contributor
  • Moderator
5411 solutions 40308 answers

That code effectively locks the pref.

Are you sure your user.js file is in the correct folder?

That code effectively locks the pref. Are you sure your user.js file is in the correct folder?

Question owner

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.

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.
the-edmeister
  • Top 25 Contributor
  • Moderator
5411 solutions 40308 answers

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 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.''''' <br /> 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.

Question owner

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.

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.

Question owner

// 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");

// 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");

Question owner

when I am posting this is converting into single line.

attaching screen shot for your reference.

when I am posting this is converting into single line. attaching screen shot for your reference.
the-edmeister
  • Top 25 Contributor
  • Moderator
5411 solutions 40308 answers

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

Sorry, I am not familiar with using the mozilla.cfg file. Don't use spaces in the "path-to" in user.js prefs. <br />Try using something like this: <br /> '''user_pref("browser.open.lastDir", "E:\\kan\\725_Images_102161_431653\\");''' <br />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''

Modified by the-edmeister

Question owner

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 :)

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 :)
the-edmeister
  • Top 25 Contributor
  • Moderator
5411 solutions 40308 answers

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.

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.

Question owner

I had copy pasted your code and tried. Still no result.

Please update

I had copy pasted your code and tried. Still no result. Please update

Question owner

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

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
cor-el
  • Top 10 Contributor
  • Moderator
17580 solutions 159060 answers

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.

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.<br /> 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.

Question owner

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.

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.

Question owner

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

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
Yaron 5 solutions 189 answers

Hi shabukumar,

Have you found a solution? user.js doesn't work for me either.

Thanks.

Hi shabukumar, Have you found a solution? user.js doesn't work for me either. Thanks.
cor-el
  • Top 10 Contributor
  • Moderator
17580 solutions 159060 answers

Helpful Reply

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.

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.