Select directory for HTML5 multiple file input in Firefox? - html

I want to allow users to select a local directory on a webpage (and then read all the files in the directory).
In Chrome I can add the webkitdirectory attribute to enable this functionality. According to a comment in this question and an answer to this question you should be able to do the same in firefox using mozdirectory but I am unable to get it to work.
I have tried the following in Firefox with no luck (works in Chrome):
<input type="file" id="files" name="files[]" multiple mozdirectory="" webkitdirectory="" directory="" />
My Firefox version is 10.0.
Are there any way for a user to select a directory for input in Firefox without requiring an add-on on the client-side (like Flash)?

Firefox doesn't have any API to upload directories yet (which is a shame)...not even in the nightly builds, so I don't think we will see support on this very soon. IE doesn't have one either. If you want to take advantage of this feature you must force the users to use Google Chrome (e.g. make them aware that upload directory is available only in Chrome).
A workaround would be to compress the directory in a .zip file and read it with the FileReader API. See https://stackoverflow.com/a/7842896/613453
Update
IE Edge now has support for this.
https://msdn.microsoft.com/en-us/library/mt574730(v=vs.85).aspx

Now you can upload directory using drag and drop with chrome
read this article you will get more info
http://updates.html5rocks.com/2012/07/Drag-and-drop-a-folder-onto-Chrome-now-available

Related

Getting a fakepath when trying to upload a cv

I'm trying to upload my resume to a company's website and I'm getting a C:\fakepath\myfilename,
Does this means that my file can't be uploaded to the website? or is it just for security reasons?
(I tried uploading with Microsoft Edge and Chrome)
When a file is chosen using an <input type="file">, the real path to the source file is not shown in the input's value attribute for obvious security reasons. Instead, the filename is shown, with C:\fakepath\ appended to the beginning of it. There are some historical reasons for this quirk, but it is supported across all modern browsers, and in fact is defined in the spec.
So, the browser shows the fake path for security reasons and it will not cause any issue with the file upload functionality. The file upload will work fine.
References:
Refer to the second point of the Notes section
FileUpload in Chrome giving some fake path value
FakePath issue in Chrome browser

How to force chrome to download an url with custom filename

Tried this:
Download Your Foo
Chrome unfortunatelly completely ignores the download attribute.
What can I do? Ideally to make it cross-browser...
Thanks
Have you tested this on any other web browsers.
According to w3schools here, it is an HTML5 attribute and internet explorer and safari do not support it. So, if you are looking for cross-browser, this probably isn't the best solution.
Also the link you have composed is wrong, if you downloaded google.com it points to index.html(I checked) .
I tried <a href="http://www.google.com" download>Here</a> and opened it in the latest chrome and it downloaded index.html. So if you need google chrome compatibility do a download attribute with "[your choice].html".
If you would like cross-browser compatibility I suggest you use php to change the headers then echo google's source. If you are unfamiliar with php go to
here

input tag to get file path

I've observed that the selected file path is being displayed on Internet explorer and same does not appear in any other browser as shown below,
<li>Left File : <input type="file" name="dataFile1" id="fileChooser1" /></li><li><br></li>
<li>Right File : <input type="file" name="dataFile2" id="fileChooser2" /></li><li><br></li>
<li>Config File : <input type="file" name="dataFile3" id="fileChooser3" /></li><li><br></li>
So how do I get the path like in IE in chrome?
For security concerns modern browsers such as Chrome and Firefox do not provide you with any path information, therefore you simply can't access it. I don't think you want to rely on a feature which is only provided by IE6 and earlier versions. Also, why would your web app need to know about the full path of file to be uploaded back on client's local machine. It would be great to know the use case for the same. I am curious.

Why is Chrome Web Developer tools not listing some JavaScript files as of version 27.0.1453.93?

Our team uses Chrome Web Developer tools to debug JavaScript. As of yesterday when our browsers upgraded to Chrome Version 27.0.1453.93, the Sources section no longer lists all the JavaScript files. Does anyone know if this is a bug or if there is a setting? Some JavaScript files are still listed but I can't find the criteria for files being listed or not. I checked on an older Chrome Browser pointing to the same URL and all the files are listed. Anyone solved this?
I guess you may have some javascript code that has been loaded dynamically. If it is the case, you should use the phrase
//# sourceURL=foo.js
at the beginning of your javascript code. foo.js will be assigned it by debugger. And debugger will show it with that name.
chrome and firebug accept it, I am not sure about other browsers

Launch file:// from Firefox or Chrome

I am looking for a way to launch a file located on our local file network for use via our local intranet using Firefox or Chrome.
The link works well in IE:
View Report
but in Firefox it shows:
View Report
is there a way to get the link to render properly?...Just a simple click from a href tag.
For Chrome, a new extension was just posted today! It's called LocalLinks and it replicates the functionality of the locallink add-on for Firefox! You'll find it on the Google Extensions page, or you can get to it directly here:
https://chrome.google.com/extensions/detail/jllpkdkcdjndhggodimiphkghogcpida
Enjoy!
This is not enabled in firefox for security reasons (remember that most computers have files and applications of a sensitive nature located in similar locations, like C:\System\Windows)
you can try adding this to the user.js file for any user that needs to be able to access these links:
user_pref("capability.policy.policynames", "localfilelinks");
user_pref("capability.policy.localfilelinks.sites", "file:///[[PUT SERVER NAME HERE]]";);
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");
Just remember that this is a security risk.
Firefox seems to want file://///Start/Of/My/Network/file.xlsx
Chrome and IE handles that too.
file://Start/Of/My/Network/file.xlsx appears to work in Chrome as well, sometimes firefox hics up on it..
There is the LocalLink add-on for firefox. It uses a context menu though...
Use IE tab (available for Chrome and Firefox) and set that to handle all links of the form file:/// by adding an autourls entry like this:
r/file:///.*
Technically this isn't opening the file in the original browser, but it gives you all the windows explorer integration you'd expect from whatever IE version you've got installed when dealing with local file links. I would advise against doing this except in cases when the browser isn't being used to access the web - e.g. for viewing internal wiki or intranet pages, due to the obvious security risk.