Flex Write File - apache-flex

I checked in the API, that writing a file is only in Flex Air.
Despite of that, is there still a way in Flex to write a file on the server or on the client machine ?
More concretely, it's because I have a String and I will decode it by mx.utils.Base64Decoder
to a doc. And I need to open it by Word directly on the client side, or write it on the server and return the link to the client for downloading.
Thanks

I'm doing something similar - I have built a custom grid in Flex that contains an additional button on it that allows the user to open the data up in Excel. I've done this by writing a function in PHP on the server which my Flex speaks to. This creates the CSV file on the server and the function passes the link back to the client, which in turn offers the user the chance to open the data up in Excel.
I'm using the Zend technologies to accomplish this - I recommend you take a look; they're extremely good. I used to use Flex Data Services and Java do do this but just recently switched to PHP because development time is cut down drastically as a result.
Hope this helps.
Jamie.

AIR applications run on the users' desktops. They allow you to write to the users' desktops. Nothing stops Flex/AIR applications from communicating to the server, write some files there (using a suitable backend technology) and return a link back to the user.

Related

Word VBA / Macro run on server Application.Run, ASP.NET, DCOM

I am not a coder but need a task done.
We have a website that builds a word doc file using ckeditor based on answers from clients.
This documents needs afterwards to be formatted (TA/TC functions of word) which cannot be done with ckeditor.
Therefore we have a VBA/ macro that needs to be run in MS word after the doc file is generated.
I want to automate this step and have the VBA/macro run, before the doc is send to client.
So from my understanding, you have to take the CKeditor doc, run the macro on the server, and store it in the current database..
Possible or not?
This should not be done server-side. Working with Office applications server-side is not supported - Office applications are end-user applications. They can easily appear to "hang" when used, due to waiting for user input.
More information about using Office on a server can be found here
Possible: theoretically, yes, but impossible for anyone to guarantee as the code and document content are unknown. But, theoretically, if it works on a desktop it can work when run on a server.
The more "correct" way to manipulate Office documents on a server is to work directly with the Office Open XML files, instead of opening them in the application interface. The file formats were designed for this scenario and execution is also much faster. I'm guessing, however, since TC and TA fields are mentioned that the macro also builds TOCs? If yes, then the document would also have to be opened in order to generate the TOC (update the field). Server-side, that would mean using Word Automation Services, which is part of SharePoint.

Loading/Saving Word Documents from Web App (asp.net MVC)

I'm making a web app. Part of it includes the automatic generation of word documents (letters). Those documents need to be opened by the end user, then saved back to the server once they've finished editing.
I tried using webdav for this but the only browser I could actually launch word from (using active-x) was IE. I also found a plugin for firefox, but for Chrome I couldn't find a way that worked.
Next I thought about making the clients map a drive to webdav (or similar), then offering up the files as file://... links, but that only works if the webpage is on the local machine.
Before I resort to ditching word (the clients won't like this) and using CKEditor or TinyMCE, is there another way?
In short, I'd like to have links to a document on the page, which when clicked are opened in word, but the file should stay remote - and then when saving, it's the remote file that gets updated.
I've also looked at Zoho but it could be very expensive for this project, plus I don't think it can be white-labelled and also looks a bit old fashioned, UI wise.
Maybe Sharepoint can do what I need? Haven't looked at that much. Also thought of making a client app to run in the system tray and deal with things.
If there was a decent way of editing Word docs from within the browser with something like CKEditor/TinyMCE and once finished, conversion back to Word format actually worked 100%, that would suffice.
I'm open to totally fresh ideas if anyone has any...
Currently Chrome, Firefox and Safari support MS Office plugin. They can open and save documents directly to server. I have tested this with MS Office 2007 and MS Office 2007 just about a month ago.
Ideally, your users would be able to use Word natively. Is there any chance you could create an Office Add-In that hooks into the BeforeDocumentSave event, looks for some indicator that the file is associated with your application, and save the updated file to your server?
Saving to the server via the Word Add-In would probably need to include some unique identifier (in addition to file name), so you could overwrite the previous version server-side. Then, if you were using something like SignalR, you could trigger a refresh on the web page when the file was saved successfully (assuming they were still on that web page) on the server (via FileSystemWatcher).
Had same problem myself.
I solved it by setting up a webdav share on the server with digest authentication (SabreDAV), and tied it into the users table on my app backend.
In relation to the client end, I solved accessing this by creating a small java applet which uses the java Desktop class (getDesktop().open()) to open the file. You will need to make sure the path is handled right for the client machine type (Windows, OS X or Linux)
You will also need to get your end users to permanently mount or map the webdav share locally.

How to push data from excel to SQL Server?

I have written a simple ASP.NET MVC 2 application that stores data and can dynamically create excel files using Microsoft's openXML for excel files.
What is the best way to push changes the user makes in excel to my database? I know it can be done via file upload, but this is rather obtrusive to the end user to navigate to my site, select upload, and then select their file.
Is there a way to do 1 click publishing from the excel file using VBA? VBA can interact with the database directly, but this seems dangerous from a data security standpoint, and duplication of logic.
Do web services work with the MVC architecture? How do I get a vba macro enabled document to send itself to the server?
For anyone out there looking for a fix, I ended up using vba's InternetExplorer.Application object and interacting with an upload form on my site.
For more info on the upload form check out:
http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx
For more info on VBA and the InternetExplorer.Application object check out:
www.motobit.com/tips/detpg_uploadvbaie/
You might take a look at Sql server integration services for bulk upload of data into sql server. The integration services once created can be run using a normal c# desktop program or using a windows service.
But you might
need to make sure this happens in the background and will have to be
an asynchronous task.
also need to make sure it is properly secured
by not giving direct execute access to any other users
I'm assuming that this is for a specific user. I've done something very similar to what you are describing before.
Tell the user to save the excel file in their DropBox and share the file with you.
Have the server listen for changes to this file and run a server side routine to import the data.
Disclaimer: This is not a secure solution, but it's easy and will get the job done.

Advanced image editing off the web

I'm building an app in ASP.NET that will store some pictures of objects. The pictures will be uploaded by suppliers and downloaded by subscribers. In between, they will have to be edited before becoming available to subscribers.
The editing involves creating a cropping path tightly around the object in the picture, in which some advanced desktop image software will have to be used I suppose.
My problem is in exchanging pictures between my ASP.NET app and the desktop software in a manner that is easy and transparent for the user.
I've done some thinking and I've come up with:
- Manually downloading and uploading the image (Not much user friendly...)
- An image editing program that can upload to a web service (Haven't found yet...)
- Develop a plug-in for an image editing program (Too advanced...)
I'd appreciate any suggestions you may have, thank you!
It sounds like you need some automation to move files between the web server and a file share. I am assuming that the number of images that need to be processed is pretty large, because if it's not, then the overhead of downloading/re-uploading each would not be that much.
So do the following:
1) Create an API for your web app that lists files that are available, or new files since some date/time, or files that have been marked as "new". The API should probably also allow marking a status on them (so you can tell it when you've finishing pulling something down, and it won't be offered again) if you don't want to trust date/time as an indicator of it being new.
2) Write an app (non-web) that runs on a schedule and uses this API to automatically download files to a shared filesystem area in your local network, and marks them as "downloaded"
The app should also monitor these files (the ones it downloaded & saved to your local share) for changes, and if changed, upload them back to your web app. To do this you may need to keep a database of filenames and modification dates/times.
This shouldn't be too hard to write in whatever language you are using for your web (assume c# or vb). By "API" I just mean, a web page that provides a list in a standardized format (e.g. json) that you can parse with your automation application, and another page that allows posting the file back for re-upload.
I'm assuming that the web server is not your own, or generally, you can't simply have it save the file uploads directly to some area where your image editors can access them. Otherwise you could just do that.
Meanwhile I came out with another possible solution.
I'm thinking of having our own windows app on the editor's computers. This app will be associated with a custom extension. When an editor downloads a file (with this extension) for editing, it will be opened in our application which in turn will open the image in some editor program.
This app will be monitoring the files for changes, and in such case, it will upload these images.
Any thoughts on this?

ASP.Net File Upload with CRC check

Is there a file upload control for ASP.Net which performs a client-side checksum calculation (CRC, MD5, etc) on the file contents and transmits the checksum to allow for server-side checksum validation?
I have looked through answers on several file upload questions, but did not find this feature mentioned anywhere.
From javascript you won't be able to detect the size of a file in the client computer. Javascript runs inside a sandbox and cannot access local system files, which will be a ecurity violation.
You can use silverlight and can get the file size and calculate the sum. You can check this
Silverlight File Uplaod
You'll need some client code to open your file, compute that check sum and to post it to your webserver with your file content; you can't do that with plain javascript, as you're not supposed to have access to your user filesystem.
But, just like #Dan Herbert commented out into your question, to use a client application like Flash, Java applet or Silverlight to execute that. I just wanted to make a more complete answer and to explain why you can't do that.

Resources