Creating an image handler in Visual Basic for Ajax file upload - asp.net

I'm not asking for detailed code for this question, but rather solid direction to learn how to do it myself. There appears to be many methods and directions so just looking for a headstart from someone experienced.
I have a simple file upload control. I want it to operate as an ajax upload, no page-refresh, and if I'm understanding correctly I need http handler that grabs the image and deals with it behind the scenes.
So I need to create a custom control, a new file upload that allows me to set some properties, such as... Path for the image, prefix for three different types (I.e. thm_uniqueimagename.jpg, med_uniqueimagename.jpg, lg_uniqueimagename.jpg) and an option to either KeepOriginal="True/False".
I'd like to see a progress bar while the image is uploading as well. A fantastic example would be a post on Facebook and how you can upload an image.
Right now I'm stuck with a standard upload control that has full post-back/refresh and it's just not nearly as attractive.
I'm just now learning VB... So basically if you can say... Read this tutorial, then do this, then do this... that would be greatly helpful. Just overwhelmed with what to do first, and how to put it all together.
Platform: Windows, .net, etc.
Thank you for any advice.

If you want a better user experience, then I suggest you investigate some solutions like the following:
ASP.NET AJAX file upload
AjaxFileUpload.
Note: If you read the documentation for the ASP.NET AJAX AjaxFileUploader, it says that it requires HTML5 for the progress feedback; otherwise it shows a spinner. So if progress feedback is a necessity and you cannot fully support HTML5 in your target browsers (i.e. older versions of IE; IE6, IE7, IE8, etc.), then you should look into the options below.
Custom HTTP module
NeatUpload is a free option.
Silverlight/Flash option
SWFUpload is a free option.
Asynchronous chunking option
RadAsyncUpload - Telerik's ASP.NET AsyncUpload is a pay option, check website for pricing.

Related

Embed editable MS Word document on web page

I need to present Word and PDF documents in a read-only preview, via an ASPX/HTML page to my internal users. In a related requirement, I need to present editable Word documents, via ab ASPX/HTML page, to parties outside of our network - effectively the public.
We cannot rely upon Word or Adobe-type PDF plugins being available on the destination PC.
Can anyone suggest a way to do this?
Edit - For clarity, the document/data would ideally stay on our own servers.
What about using Google Docs API? You could use either their word-like doc or a form to get the data you need, and then present that internally.
Not sure if this meets all of your requirements, or is an available option.
For our company, we have a few tools that utilize Google Docs. We upload data dynamically to them for specific needs.
Based on your requirements, maybe it's best to just write your own. I haven't created a Rich Text Editor. But it looks like there are quite a few tutorials online. Here is a basic tutorial for a rich text editor. It's using javascript, HTML, & CSS. If you prefer to not use js, then you may need to look for other tutorials.
This isn't the most glamorous solution, as it looks like the users view would be HTML. I'd think you could have it updating dynamically off to the side with an actual rich text view (similar to how Stack Overflow has theirs below an answer or question being written).
Update
Over the weekend I was exploring HTML5's contenteditable attribute, I came across an editor that builds off of that called Aloha Editor. It's a WYSIWYG type editor. But if that's something that you desire for your clients, than this would probably be a pretty simple integration. I have yet to use it, but it seems like it would be a great fit - if you decide to go the route of building your own editor.
You could use the Zoho API or, if you need to keep all data on your own servers and validated clients at all times, you could try the Aspose components.
If you're interested to provide documents in a view-only way then you can try GroupDocs as well: http://groupdocs.com/. They offer viewers for different file types which you can add to your website very easily: http://groupdocs.com/apps/viewer.
Since you need to keep data on your own server, aceoffix can be one of your alternative. It is a plugin installed on your own server and save all data on your server too.

Asp.net flash muti-file uploaders - Is MultiPowUpload ok, or which is the best and easiest?

I am considering using the MultiPowUpload control from element-it on a project, as well as perhaps on a second. Does anyone have any feedback on that particular control? Does it actually work as advertised, handle errors well, etc?
I've played with quite a few others, but that seems the best so far. The easiest for the junior members to get off and going with, nearly all features out of the box, etc.
Some of what I need to do:
Multi-select of files (from a single 'browse' click, not multi-textbox)
Progress bar (client requirement)
Queue for upload (it's ok if it can only upload immediately)
Feedback from server - custom error messages (permissions,etc)
Pass the session ID automatically, but I can use a URL hack for the upload page too
Be able to remove files from the queue
Support large files (~50MB, really up to 300mb would be perfect)
Accessible/usable JS api
Can change the view style a little bit at least!
Localizable - we need english, chinese, italian, and possible a few others
Resume incomplete transfers (eg, connection dropped, so on, not required, but ++)
I've been working with all of these below, and gotten most of them working in demo pages, finding issues as I go along.
Fancy Upload - quite nice, but no feedback from server, uses mootools not jq
MultiPowUpload - looks good, resumes, no flash cookie bug, $149
Uploadify - looks reasonable, real world though?
YUI - mostly custom code, will work but tedious
SWFUpload - no progress bar, otherwise pretty basic & good
JQuery Multifile (fyneworks.com) - inconsistent browser support
devex / telerek - missing to many required features, sadly
PL UPload - nice, but missing 'retry' and error reporting. may be able to add
So, does anyone have any real-world experience with MultiPowUpload, or have suggestions for a free or commercial option?
PL UPLOAD WON - for now! If we get complaints, or find it doesn't work in our real life scenarios, then we'll consider switching to MultiPowUpload. But it is good enough, and we can write some JS to do a few of the missing things. With chunking I had no problems with 300mb uploads. Yay.
Did U try this one.
Plupload
Allows you to upload files using HTML5 Gears, Silverlight, Flash,
BrowserPlus or normal forms, providing some unique features such as
upload progress, image resizing and chunked uploads.

Ajax File uploader

I just wanted to ask a question about uploading files via AJAX. I have researched on the web and found many articles on doing this. I am using ASP.NET 2.0.
I am probably going to go the jQuery route on this one, but I'm still unsure, I just need some feedback. Bacause my aim is to create an admin page for my client to add new products to his site when my client wishes to, so my client wants a simple file uploader and a multiple file uploader.
The first question is which is the best AJAX File Uploader to use?
The second question is how many files can you upload via AjAX, are there limits to how much you upload with different techniques ie. using jQuery or SWFUpload or using IHTTPHandler?
I would be grateful for your feedback.
Thanks.
I actually had to do this for an item here at work. To keep things rather simple, I went old-school and used a hidden iframe to do the file transfer in the background. There may be more fancy ways, but this worked for me. Also, there's no headaches when Adobe pushes out a bad update.
It was a while ago, so I can't remember the nuts n' bolts of the top of my head, but here's an article that seems to be using the same idea:
http://www.openjs.com/articles/ajax/ajax_file_upload/
This is a subjective question, as there is no one solution fits all for your application. The right answer is the uploader that meets your business needs. Limitations, if they exist, are set per whatever component you decide to use.

Showing a form from a webpage

I have a problem I am trying to solve in an elegant manner. I have a .net application that I have created. I am trying to get one of the forms to be shown from a webpage. This sounds strange I'll admit, so here is the backstory
We have some large monitors at work, that show information on them. I have no control over how the information is displayed. Currently they are just using a browser and tabbing in the browser to show each different piece of information on the screen. Most of the info they show is just standard html stuff, text and images.
Now along comes my winforms application. The part of the application I need to show is a graphical display. Everything on this display is drawn using GDI+, if that matters. I need to get this form into a format that I can show. Below is my own solution, but I am pretty sure this is not the best method, but it may be the only method I can use
Create a console application. The application would do the following
1. Run as a service on a server
2. Create the display in memory, and save it to a bitmap every so ofter
3. Save the bitmap to a location on the network.
4. have an HTML file that links the image that can be shown in the browser
I though about doing something with the clients, however the clients are not always up, so I could have periods where the image wouldnt be updated.
I also was thinking about an ASP.net solution, but that would require me to learn ASP.net, and I am not quite ready to take that challenge
In IE you can host a winforms app/control as an ActiveX control, like so:
<object id="DateTimePicker" height="31" width="177"
classid="bin/Web.Controls.DateTime.dll#Web.Controls.DateTime.DateTimePicker" VIEWASTEXT>
</object>
See this article for more information: http://www.codeproject.com/KB/miscctrl/htmlwincontrol.aspx
Now, I'm not claiming that this is any more elegant than your solution, but it is an alternative.
I think using Asp.Net to serve a dynamic image using a HttpHandler would be the best approach, but depending on your skills and time this may not be an option. Here is a nice tutorial: http://www.codeguru.com/columns/dotnet/article.php/c11013
IMHO The best way to build this would be as a browser plug-in, like how Flash works. Microsoft has created a plug-in framework called SpicIE, that allows you develop managed plug-ins for IE. This is probably your best bet.
The old unmanaged way is to build out your WinForms dll app and then package it in a signed cab file, and then reference that cab file with an HTML object tag (codebase arg is the one you need).
i.e.,
document.write("<object CLASSID='clsid:DC187740-46A9-11D5-A815-00B0D0428C0C' CODEBASE='/MyFormsApp/MyFormsApp.cab#Version=1,00,0000' />");
The first time the user hits the page they will be asked to allow for the installer to load its payload (dll's). Once they do, they will have a fully fledged WinForms desktop APP running through a browser window.
I took the easy route on this one. I created a small winform app, that coverts the GDI objects to a bitmap, and then I save the bitmap to a network share. This file is refenced in a simple HTML file that is displayed on the monitor.
I chose the winform app, because it makes it really easy for me to set this up in task manager, and run it every 10 minutes to update.

Which Javascript history back implementation is the best?

There are implementations for history.back in Micrososft AJAX and jQuery (http://www.asual.com/jquery/address/).
I already have jQuery and asp.net ajax included in my project but I am not sure which implementation of history.back is better.
Better for me is:
Already used by some large projects
Wide browser support
Easy to implement
Little footprint
Does anybody know which one is better?
EDIT:
Another jquery plugin is http://plugins.jquery.com/project/history It is recommmended in the book JQuery Cookbook. This one worked well so far.
One alternative to jQuery Address is the nice jQuery history plugin. There are also URL Utils.
Reference: AJAX History and Bookmarks.
If you are building an ASP.NET application then using ASP.NET Ajax Framework gives you many advantages and a nice-simple API to use server-side.
Below you can find an example that uses Browser History with ASP.NET Ajax
Create a Facebook-like AJAX image gallery
Both have a wide range support in browsers.
For me is easier to integrate Microsoft AJAX Framework in an ASP.NET page so again if you have an .aspx page it might be easier to work with ASP.NET AJAX
If you don't need exactly AJAX, i.e. updating only parts of the site on request is sufficient for you, then you can use invisible iframe as target for loading generated HTML file containing only JS script that updates/resets "updateable" parts of the site. This is cross-browser solution and doesn't need address polling.
Example, but not in ASP: kociszkowo.pl (Polish site)
When you click there in the section icon and your browser supports javascript, link is modified before being fetched - target is changed to iframe and href is suffixed with .dhtml to inform server, that we're interested in a special version of the page. If you press Back in your js-equipped browser, then previously fetched iframe page is loaded from the cache. Simple, but requires some decisions at architectural level.
This link modification is irrelevant here, it's just the result of combining JS/non-JS world.
In my experience, your best bet is using the same one that you have doing most (if not all) of your ajax calls. For instance, if you're using asp:UpdatePanel's, use the MS one - if you're using jQuery.ajax, use the jQuery history plugin. If you're doing a mix (which I've tried to avoid in my projects), I'd personally test with both and see which behaves better - if they both test fine, then it's a bit of preference. Some may argue the Microsoft one would have better support, but jQuery's history plugin may get more use and more mature.
http://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.aspx
http://docs.jquery.com/Ajax/jQuery.ajax#options

Resources