What I want to do is: when a user clicks on a button, a folder browser should pop up almost the same way when <input type="file"> is used. The only difference is that I don't want that "Open" button, I want a button with "Save" as text. See that I'm not looking for a file saver in javascript, I just want a dialog that user can navigate inside folders, insert a file name and click on a button called "Save", so that I can make the file saving server-side.
Thanks in advance.
The file browser is part of the operating system, not the web page. Sorry.
Related
I have found some examples that trigger "click" event to hidden <input type="file" /> to open a File Chooser dialog by using Javascript.
For example, when a user clicks an image button, the browser shows a File Chooser dialog even if the user does not click [Browse] or [Choose file..] button which is basically accompanying with <input type="file" />.
However, it requires 'user interaction' that means users have to somehow manually 'click' buttons to open the dialog.
I want to invoke a function to open the dialog without user interaction. However, using 'normal' methods are failed and shows "File chooser dialog can only be shown with a user activation"
The reason why I need this is that I want to open the dialog in a WebView control in both Android(WebView) and iOS(WKWebView) applications by using Javascript eval()-like method.
But as written above, eval() failed because it is considered non-user interaction. I need an alternative or detour solution.
I have some pages with file browser input.
Everything works fine, but to prevent the user to click the Add Files button many times or to click in some another link in the page I want to make only the file browser window clickable (Gmail have this feature when you want to attach some file in the email for example).
I don't want to use
e.preventDefault()
Because when the user choose the file or cancel the file browser I need to enable the button again.
So basically I just want to "block" clicks outside of File Browser Window.
Someone have some idea how to do it ?
I got a webpage where members can download different kind of files on. I wan't to get information about which files and how many times each member have downloaded. when the user want to download a file he get browser pop-up where he gets 3 choises: "Open", "save" and "Cancel".(file dialog box in browser). i want to update the download status only if open/save button is clicked
Is there a way to detect which button was clicked on "save/open/cancel" dialog?
You can't know that. Some browsers even start the download before the user decides what to do with the file. But perhaps you can get your webserver to log if the download has been completed. That's probably the most reliable result you can get.
There is no way to know which button was clicked.
I dont think you can. The site just streams the file to the browser. What the user does
with the file is not known by the website as there is no more server side
interaction.
I have this:
<div class="openexcel"> Open excel file </div>
I have added this code too:
$('.openexcel').click(function(){
/* some code here*/
});
Is there any way or any code to add to javascript where I can stop the "save" button once the excel file is opened.
I need the user to read and see but I don't want him to "save" or "save as"
This isn't possible, especially not using javascript.
Once the user opens up the excel document, it is open on their local machine, from their local cache.
You won't have any control over the functions available within their Excel software.
When making data available over the web, you need to accept that there is not a way of preventing people from keeping hold of this data.
I'm developing a custom module for Drupal dealing with Document Management. At this point, the module loads, you can upload files (via a hidden iframe and some ajax requests), browse directories and set various levels of permissions. And everything works perfectly in Firefox.
Issue:
In IE however, I run into an issue. For some reason when I upload a file the save file dialogue pops up and asks me to download the file I just uploaded. It looks like it's asking me to download it from the web-servers tmp location however, as that seems to be the file-name and such. However, if I hit cancel and refresh the page I can see that the file I uploaded did actually get uploaded to the server.
Here is how the upload process works. Click the upload button. The upload button is the standard file input form element hidden and placed over a styled version of the button. Clicking on this causes the "Choose a file" dialogue to open.
Select a file and click "Open". A modal dialogue pops up asking you for some further information about the file. The modal is part of the same form element but remains invisible until you click Upload button
Clicking save in the modal causes the file to be uploaded. The "action" attribute on the form is pointed to a page and the target is the iframe.
The iFrame is polled a few times every second to see if it's contents have changed. When the file is uploaded a "success" message appears in the iframe. Since it belongs to the same domain, I scrape the content within the iframe.
Once the iFrame says that the file has been uploaded, I use some JS to update the application with the name of the file
Since I can't use Firebug in IE, I have to stick to utilizing Microsofts Web Developer Toolbar, which makes it very hard to figure out if the bolded step is actually occuring. It seems like it should, since the file IS being uploaded. It is just getting interrupted by that file download dialogue.
Since no one seems to have an answer, I'll post the fix I found. I doubt it's perfect, but it's the best solution I could come up with.
It turned out to be an issue with the polling as suspected. The fix ended up being instead of outputting json to the iFrame, just output some JavaScript that calls a function that updates the main window. That simple.