Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , ,

Sponsored Links


OpenFileDialog in SilverLight

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 05-08-2010
Member
 
Join Date: Jan 2010
Posts: 126
OpenFileDialog in SilverLight

Sponsored Links
Hello,
I am writing prog C # with Silverlight, a dialog box to download the file, other than 'that I need to get the file name and path to file as a string, the file name but the way I do not know it is not working. Do you have any sample code for this? Any help will be great. Thank you.

Reply With Quote
  #2  
Old 05-08-2010
Member
 
Join Date: Nov 2009
Posts: 359
Re: OpenFileDialog in SilverLight

Hello,
Try the following code

Code:
 OpenFileDialog opfld = new OpenFileDialog();            
            opfld.Multiselect = false;
            opfld.Filter = "All Files |*.*";
 
            if (opfld.ShowDialog() == True)
            (
                System.IO.FileInfo fl = opfld .File;
                   
                    string fileName = fl.Name;
                    / / Call to the Next Swearing, such as forbidden               
                     d=fl.Directory                          
                    
            )
Reply With Quote
  #3  
Old 05-08-2010
Member
 
Join Date: Dec 2009
Posts: 211
Re: OpenFileDialog in SilverLight

I have changed the above code and this is in more advanced form.
Code:
OpenFileDialog opfld = new OpenFileDialog();            
            opfld.Multiselect = false;
            opfld.Filter = "All Files |*.*";
 
            if (opfld.ShowDialog() == DialogResult.OK)
            (
                / / fl path
                string path = opfld.FileName;    
            )
Reply With Quote
  #4  
Old 05-08-2010
Member
 
Join Date: Jan 2010
Posts: 126
Re: OpenFileDialog in SilverLight

Code:
 / / File path
string path = OFD.FileName;
I had tried, but alas not want it so, in Silverlight at OpenFileDialog no property FileName, there is only ofd.File.Name but it gives me only a name, but I need a way. Thank you
Reply With Quote
  #5  
Old 19-08-2010
Member
 
Join Date: Mar 2010
Posts: 383
Re: OpenFileDialog in SilverLight

Here's an example correctly, the OpenFileDialog in Silverlight (build System.Windows.Controls, namespace System.Windows.Controls)

Code:
OpenFileDialog Dialog = new OpenFileDialog();
But it is theoretically possible to obtain the directory path, because it marked attribute. Critical security, ie the code to compile, BUT will Not work (in Silverlight is Not Allowed), BUT it will work for WPF-Applications

Code:
DirectoryInfo dirInfo = Dialog.File.Directory;
string nameInfo = Dialog.File.DirectoryName;
Reply With Quote
  #6  
Old 20-08-2010
Member
 
Join Date: Aug 2010
Posts: 40
Re: OpenFileDialog in SilverLight

via JavaScript and I got this way, but this does not help to solve the main problem - I need to copy the file to the server ... CAN this be done Via JScript? Silverlight markups below do Not allow to do with the files ....
Reply With Quote
  #7  
Old 25-08-2010
Member
 
Join Date: Nov 2009
Posts: 359
Re: OpenFileDialog in SilverLight

Silverlight application runs in the sandbox .. Just got the name and path you do not do it. In-class dialog to open a file must be property in which remains something like FileStream (file stream). Reads its contents and sends it to server. Or, once more through ActiveX and JavaScript
Reply With Quote
  #8  
Old 26-08-2010
Member
 
Join Date: Aug 2010
Posts: 38
Re: OpenFileDialog in SilverLight

The same applies to the conservation .. You open a dialogue - it is an addition, dialogue, save more and asking the user to bypass the security system for a specific individual file. Therefore, the class file dialogue in SL modified so that you do not get the file path, but you get access to it through a copy of the file dialog. They took from it a file stream and write-read. The user you solved it, by clicking on OK in the dialog.
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "OpenFileDialog in SilverLight"
Thread Thread Starter Forum Replies Last Post
Silverlight 5 released; will there be a Silverlight 6? GopuHD Windows Software 4 11-01-2012 01:28 PM
While installing Silverlight I get "Silverlight is already installed" message Raja Ram Windows Software 5 28-04-2011 10:27 AM
How to install SilverLight 5 beta and SilverLight 4 on same Computer Mandarmalika Windows Software 3 17-04-2011 04:55 PM
XAML Processing Differences Between Silverlight 3 and Silverlight 4 wllwnn Guides & Tutorials 2 09-08-2010 09:41 AM
What is SilverLight? Champak Windows Software 4 31-01-2009 09:21 AM


All times are GMT +5.5. The time now is 04:01 PM.