I have the Problem with the File Upload window. When I used it the first time it works perfect but when I call the same functionality to open and upload a File the open button (in the "Choose File to Upload" Dialog) is pressed to fast. So the Test can not write the complete path of the File over set and so the I can not open the File.
The Source Code of the function:
public void OpenFileDialogAndUploadCsvFileWithName(string fileName, IE editPage)
{
var fileUploadDialog = editPage.HtmlDialog(Find.ByTitle(PageTitle));
fileUploadDialog.WaitForComplete();
FileUpload fileUpload = fileUploadDialog.FileUpload(Find.ById(new Regex("_FileUpload")));
fileUpload.Set(fileName);
Image image = fileUploadDialog.Image(Find.BySrc(new Regex("/icons/upload.png")));
Element parentElement = image.Parent;
parentElement.FireEventNoWait("onmouseup");
parentElement.FireEventNoWait("onmousedown");
}
The Upload File Dialog is open from Internet Explorer Modal Dialog Window.
You might find that the file upload dialog handler is running on a different thread, and that is why you don't get a chance to enter your text.
If that is not he case, and it really is a problem with the dialog handler then I would grab the code for the fileUploadDialog handler and create my own, custom, slower version.
Related
I want to create a button in a googlesheet/google Apps Script that opens an existing google sheet in a new tab when u click on it. I will insert the button in a google sheet, so i basically just need a code that i link to the button.
The code below does not work somehow?
Can you help me?
function openURL(){
var button = CardService.newTextButton()
.setText("This button opens a link in an overlay window")
.setOpenLink(CardService.newOpenLink()
.setUrl("google sheet")
.setOpenAs(CardService.OpenAs.OVERLAY)
.setOnClose(CardService.OnClose.RELOAD_ADD_ON));
};
In order to create such button and functionality, you will have to:
Create the code that will be executed upon clicking it. Go to Tools>Script Editor. Paste the following code (replacing, of course, the url for the appropriate one):
function openMySpreadsheet() {
var url = 'YOUR_SHEET_URL';
var htmlTemplate = HtmlService.createTemplateFromFile('js');
htmlTemplate.url = url;
SpreadsheetApp.getUi().showModalDialog(htmlTemplate.evaluate().setHeight(10).setWidth(100), 'Opening Sheet...');
}
Still from the Google Apps Script IDE, go to File>New>HTML File. Set the file name to be js and paste the following code into it:
<script>
window.open('<?=url?>', '_blank', 'width=800, height=600');
google.script.host.close();
</script>
Go back to your Sheets document and insert an image using Insert>Image>Image over cells and select any image you would like to have as your button.
Select the newly created image and click on the 3 dots that appear on the top-right corner of it. Click on "Assign script", and put the function name to be run (in this case, openMySpreadsheet would work).
From now on, each time you click on the button, a short-lived dialog will be shown up (that is necessary in order to open a link on a new tab) and the link will be automatically open.
I'm having an issue with the OpenFileDialog class, where the OpenFileDialog window will open, but only behind every other application I have running in my OS. I've been hesitant to ask about this, but my search using many different keywords on Google, and searching other forums, has turned up nil. I'm using the following code in a button click event of the button on my web form I want the user to click on to open the file dialog:
Dim fd As New OpenFileDialog()
Dim strFileName As String = ""
fd.Title = "Open File Dialog"
fd.InitialDirectory = "C:\"
fd.Filter = "All files (*.*)|*.*|All files (*.*)|*.*"
fd.FilterIndex = 2
fd.RestoreDirectory = True
If fd.ShowDialog = DialogResult.OK Then
strFileName = fd.FileName
End If
The dialog box opens - it just opens behind every other window...what am I missing here? Am I just going to have to do a funky workaround by minimizing everything when I call the OpenFileDialog class? All I need is for the window to show in front of the browser and every other window. Thanks in advance for your help!
openfiledialog has no place in a standard ASP.NET application. If you call ShowDialog on it, the dialog will open on the server computer (under what user session?) unbeknownst to user looking at the browser window on the client.
Use <input type="file" ... or FileUpload server control to let user select a file to be uploaded to the server.
I need to style the browse button of file upload in GWT.... I found the way through this link http://www.dreamincode.net/forums/topic/15621-styling-a-file-browse-button/. But I am not able to use the same in GWT. Any idea how to go about it?.
I am using GWT 2.4.0
I tried the following approach and it worked for me.
I hid the file upload field and used a trigger box on the screen instead. Trigger box click is delegated back to file upload browse button click using JSNI approach
private static native void fileClick (Element el) /*-{
el.click();
}*-/;
And used the fileupload.getfilename() and set the trigger text box with file location details.
I wonder how can I download/save/write a file from my server to a client's computer using flash or flex.
An example of what I'm looking for is
avilable on
http://www.flexdownloads.com
Sign up
Sign in
Click on the ("FREE") button placed on the right of the page. (the
orange button)
Choose any product (won't cost you anything)
Press "BUY NOW"
then you'll see a confirmation popup
for the download, then you choose
where do you want to save the file,
and the flash movie saves the file!
Use FileReference
http://livedocs.adobe.com/flex/3/html/help.html?content=17_Networking_and_communications_7.html
var request:URLRequest = new URLRequest("index.xml");
var fileRef:FileReference = new FileReference();
fileRef.download(request);
After submitting a form, the user is presented with a link to a pdf document.
The link is straight to the document, it is not streamed.
If the user right-clicks and chooses 'save link as,' the document saves and opens fine. However, if the user just clicks on the link, the browser takes a very long time to respond (I'm going to guess it's 3 minutes) and then adobe reader gives the following error:
"the file is damaged and could not be repaired"
This is in Chrome v5, ASP.NET 3.5 and the link is returned inside an UpdatePanel.
it depends on browser settings that are configured for PDF Links. If you change the settings in broweser, you will get the download dialog.
Mozilla Firefox
Open Mozilla Firefox
Click Tools and then Options
Within the Options window click Applications
Select the Content Type you wish to adjust. For example, if you want to change how a .PDF file opens in Firefox, select Adobe Acrobat Document.
In the Action section, change the action to how you wish to open the file. If you want to download .PDF files instead of opening them, select Save file.
Internet Explorer:
You have to right click and click save target as to download.
The other option is, create a seperate asp.net and write below code to download the PDF
private void Page_Load(object sender, System.EventArgs e)
{
//Set the appropriate ContentType.
Response.ContentType = "Application/pdf";
//Get the physical path to the file.
string FilePath = MapPath("acrobat.pdf");
//Write the file directly to the HTTP content output stream.
Response.WriteFile(FilePath);
Response.End();
}
I've had this issue before and the cause was the PDF itself.
Adobe has a slew of causes for this: http://kb2.adobe.com/cps/328/328233.html
FWIW, my PDf issue was solved by opening the PDF in Adobe and going to Document -> Reduce File Size -> Make Compatible with Version 7. (current version - 2)