为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

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

  • 22 个回答
  • 4 人有此问题
  • 2 次查看
  • 最后回复者为 ideapadz580

more options

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?

所有回复 (20)

more options

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

由the-edmeister于修改

more options

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.

more options

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

more options

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

more options

That code effectively locks the pref.

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

more options

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.

more options

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.

more options

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.

more options

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

more options

when I am posting this is converting into single line.

attaching screen shot for your reference.

more options

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

由the-edmeister于修改

more options

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

more options

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.

more options

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

Please update

more options

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

more options

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.

more options

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.

more options

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

more options

Hi shabukumar,

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

Thanks.

more options

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.

  1. 1
  2. 2