SaveDialog in Flex passes FileName and Path to Server Side C# - c#

So I've got a flex project that runs on the desktop. I've also got server side C# code that I run to export some data into a PDF when ever I click a button on the flex application. Currently I just auto save the files to the temp folder inside of the C:\ directory, but I was wondering how I would go about opening up a Save File dialog box in Flex so I can select a location and name for my file and then pass the full file path string over to the server to do the exporting. My research brought me to a "Filereference" class in Flex, however it looks like that actually saves some sort of file, where all I want to do is get the chosen file path from it.
EDIT: I'm working with a project that has both an Adobe AIR Application side and a Web Application side, both being run by common code, so it'd be best to have a method that is supported by both.

Since you said you're building a Desktop application, I assume you are using Adobe AIR. You can use the File.browseForDirectory() method.

Related

How to get the local desktop path of the users file when the application is hosted from server?

I am trying to run a macro-file that will be present in users desktop via my .net website, hence I would like to know how I can get the path of that macro file in my code and open it.
I am currently using following described code to get the path, and I think that this must be trying to take the path from server computer but I would like to get this from users computer, this particular macro file will open internet explorer and navigate to certain website and download a report to local computer hence I would like this to be run from users side.
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
Is it possible to get the path automatically or should i get that from user.
please provide suggestion.
You are hosting a website, which is using a web server like IIS and the user access the site using a browser like edge, chrome, now the file is in user desktop, so the main question remains,
Does the browser process have the access to the file system of the user
Mostly no, especially not via the call Environment.GetFolderPath(Environment.SpecialFolder.Desktop);, this will be good for running it on hosted sever, where w3p.exe process is accessing the file system with required permissions
For the end user desktop
You need to provide the file dialog box, let user select the file / directory and need to plan to serialize the file to the sever (upload) for doing any processing. You can binary serialize the file using a provider like protobuf, msgpack to achieve the necessary functionality
Code you have provided, is good for for the process where you have direct control, like Console, WPF, which runs on the system under certain permission and thus access the file system for processing

How can I open a file on the user's machine from the backend in C#.Net WebPages?

In my web-app (WebPages, C#.NET) I have a drag and drop file box where user's can drag files from windows explorer and, once dropped, it will save in a given location on a shared drive. This part is working fine. The box looks something like this:
The problem is, that it also reads files from the same directory and my user's would like to be able to open the files from this interface on dblclick. I have written an ajax request with jquery (the ajax, too, is working fine), but I can't seem to get the files to open on the user's machine no matter what I try.
Most references I try and look up point me towards System.Diagnostics.Process.Start(#"<directory goes here>") but this doesn't really do anything. It will open some process on the server side, but nothing opens, either on the server or on the user's machine.
What they'd like to do, for instance, is double click 'Hazcom.xls' and it would use the default associated application to open the file. In this case, of course, Microsoft Excel.
Is this even possible or am I chasing a wild goose here?
Sources I've Tried:
Open file with associated application
http://www.csharp-examples.net/open-file-with-default-application/
How can I open Windows Explorer to a certain directory from within a WPF app?
c# open file with default application and parameters
There have been a few more sources I've tried, as well, but they're all pretty much in the same vein as these.
Additional Info:
The internal Intranet application runs on a server using IIS 8
The solution is desired to be opened on the user's machine and not, say, the server itself.
The path to the files is dynamically changing depending on what they have loaded into the interface.
Though, I'm not expecting this to be a solution viable for client side (jquery) I'd be happy to look into that if that's the only solution available.
I'd also settle for simply opening the file location, instead of the actual file itself, but I've had no luck with this either, for what looks like the same reasons as the original problem.

Unity: Building for ios and accessing the CSV file

I have a simple app that collects user info such as name, email , job etc.. Im saving all of this info on the machine locally in this case the IPAD. This app will not be published as all uses will only work on 1 tablet. My questions is, How can i access this CSV file and open it manually after all users are done? I basically want to open the file and look at the info, but i can't find the csv file anywhere. Im using Application.datapersistantdatapath on Unity. Im using Unity and building to MAC, it's working perfectly on a windows machine.
The debug on the IPAD returns for me the path where the file is saved, now i need to open the file manually but i can't get to the path. How is it possible? the path is something like /var/mobile/containers/Data....
Application.persistantDataPath is a string, what does it tell you if you try and print it?

Set *.exe file properties after upload to server

I'm trying to find a way to write "meta" information to EXE files that are uploaded to my IIS/ASP.NET web service. Here's a little bit of background:
I need to write one arbitary string into the properties
It'll be URL that I write as "metadata", if that matters
Example: https://example.com/someFolder/someOtherFolder
The files are mainly installers originally created by InnoSetup
The web server is running IIS 7.5 with ASP.NET on top of Server 2008 R2 (Standard)
Why am I trying to write this information?
Ultimately the EXEs are made available to users for download. When the application runs, it needs to know the web URL in order to execute properly. Currently we have a plain text box where the user can input the URL, but that has proven to be error prone (despite prompting/error checking/...)
Why can't I just write the metadata in the EXE when it's created?
I could do that, but the EXE could be uploaded to a variety of different servers, each with their own unique URL "metadata". I'm trying to avoid creating a separate build script for each server.
Why not just create a *.zip file with the *.exe and an extra piece of metadata?
I suppose I could do that too -- but then the user would have to actually unzip the download so that the real installer could read the metadata. I had something similar to this before and most people never unzipped the full download and that posed its own problems.
So is this even possible? I guess as a last resort I could use the uploaded EXE to create a new EXE, but I'm trying to avoid doing that (gets into problems with signed EXEs, etc.)

open a file before uploading through file uploader in asp.net

I want to upload an exe to web server from client system through file up-loader and want to run/open that exe before uploading .how can i run/open that exe before uploading it.
Short answer: No way!
If you really want to execute it client side, the user has to do it manually, JavaScript and jQuery are not going to execute an application locally.
if you want to execute it on the server side, you should first upload it to the server.
why are you trying to do this? can you explain a bit your use case?
If you're trying to execute on the server then you'll have to upload it first. Plain and simple.
You cannot make the web client open a file or even access the files because of browser security restrictions. All you can do is access the immediate file name (e.g., file.ext) and file content once the user browses, manually selects the file, and the form submits.
The reason for this restriction is that, if a website could execute files, any site could very easily install malware on a person's machine.
On the other hand, to execute the EXE on the server, it must first be uploaded.

Categories

Resources