load images using jquery ajax in asp.net - asp.net

I am looking for a good approach on how to do the below
I have a file server where i store all of images.
I need to display these images onto my webpage using jquery and ajax.
Can someone please advise on how to do the above i can do the reading of the image from file server using a web service hosted on the file server which will return a byte array of the image, but once i read the byte array then how do i display it on the web page using jquery and ajax.
Please adivse
Thanks

Have a look at doing this with an HttpHandler.
HttpHandler Example: http://www.wrox.com/WileyCDA/Section/id-291916.html
If your're using MVC have a look at:
http://dotnet.dzone.com/news/goodbye-http-handler-hello?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+zones%2Fcss+(CSS+Zone)

Related

Is it possible to take a javascript array and SAVE it to a file server-side?

I have a project where Im using a windows hosting environment and classic asp / vbscript and need to take a Javascript array that is created dynamically and save it to a local file ( "somefilename_unique-ID-I-will-add.js" )... I've used fso in the past to create dynamic log files on a couple of projects but am unsure where to begin in terms of figuring out how to take the js array and 'give' it to or access it in .asp / vbscript especially since the .asp runs before any javascript / jquery is run.
Anyone have any idea a) if its do-able and b) how to go about it?
the resulting .js file on the server will be used as the json or jsonp data source for an android and ios app.
Thanks for any light anyone can shed on this.
You can do this.. You would need to create an API method (search for ASP web method) and post the array to the server via an AJAX call. You could then construct the file server side within the web method.
Here is a link for an example of [WebMethod] :
http://encosia.com/using-jquery-to-directly-call-aspnet-ajax-page-methods/
If this project is OK with a trip to the server, then you can merely submit a form where the onLoad of the page used JavaScript to fill some hidden form fields with the values from your array. Or even use a querystring, i.e., sender_page.asp?data001=blahblah&data002=blahdeblah&data003=blahdoobleeblah...

how to create a file manager like CKFinder - MoxieManager with Asp.Net

I want to create an ajax file manager like CKFinder and MoxieManager using Asp.Net!
can anyone help me how to start ?
please suggest me some useful references , components and tips ...
If there is an open source project like what I need, please let me know.
You first start with a simple file manager (no ajax), that simple reads the files from the disk and renders them on a page. If you place all that inside an iframe dialog, then you have something like ajax for your page.
Some examples with the code and details:
Simple-Web-File-Manager
Web File Manager
ASP.NET User Control: File Browser
and you can call them from your page, using the highslide iframe dialog content example.
After you make that and you have some knowledge you can move to ajax (if you still need it)

Using uploadify as part of an asp.net webform?

I have a web form that requires users to fill out some information and upload an image.
What I don't understand:
If I use uploadify to select a file doesn't it upload it right away to the server? Is there a way to defer that until the user would click on a form submit button? Or at least not save it to the file system?
Most examples use a custom HttpHandler for uploading files, but my file upload is part of a form. Should I still use a HttpHandler for that?
Well, I'll try to answer all your many questions, one by one. But before anything, open the official documentation because I will rely on it for answers.
If I use Uploadify to select a file doesn't it upload it right away to the server?
As you can see on the first demo, you can have a anchor (or a button or anything) to trigger the upload start. The Uploadify don't upload nothing until it's done (if the property auto isn't true).
Is there a way to defer that until the user would click on a form submit button?
Like described above, yes. And it's the default way (since the default value of auto is false).
Or at least not save it to the file system?
While the button doesn't trigger the .uploadifyUpload() method, nothing goes to the server. But when the Uploadify starts sending, it will be handled by the server (with the HTTP Handler). The handler is the guy that save it to the file system.
Most examples use a custom HttpHandler for uploading files, but my file upload is part of a form. Should I still use a HttpHandler for that?
As described on the script property, you can point to any server-side language that will handle the HTTP Request containing the data. The HttpHandler is the right thing because it haven't any other processing before or after the code you write. It isn't hard. The official forum shows some samples. And here on StackOverflow we have many questions about it, like these: Getting Uploadify Working in C# and Uploadify not working with ASP.NET WebForms.
The server shouldn't save the file until it is actually actioned by a handler. The Uploadify is providing the UI control for the gathering of the files and feedback. There are some settable properties available to control whether you want the "Auto" upload behavior or not.
You still need some king of server side processing for saving the data and an HTTPHandler is the usual way to do it. The HTTPHandler just operates on what file information it gets from the browser as part of a multi-part form data.
Here is an answer that provides more information about Uploadify: Getting Uploadify Working in C#

File Uploading without page refresh in Web pages

Hii,
Any one knows how to upload files to the physical location of the server. It is possible using file upload control that i know. But i want to avoid the external postbacking of the page. For e.g exactly like what in the yahoo mail did.
In yahoo mail latest version if you attach a file that won't post back and attach that file in to server. What is the technology behind that?
Normally when you submit a form it does a POST request to the server, causing a refresh. Ajax requests get round this by using JavaScript to send the POST data through to the server, and that doesn't need a page refresh.
Ajax requests can't be used to send file data though, so the best way to currently do it is with an iframe hack - you use JavaScript to dynamically build up a form within an iframe, submit that form via JavaScript, and listen for the iframe's onload event. So you know when the form has been submitted. A version of this approach is detailed here:
http://www.webtoolkit.info/ajax-file-upload.html
Other methods to do this would include using a Flash-based solution like http://www.swfupload.org/ or a wrapper like http://www.plupload.com/ - these will prevent you having to roll your own solution and will also provide some extra functionality - upload progress feedback, for example.

ASP.NET : Load flash movie from codebehind

I have an ASP.NET web page where i need to show a flash movie. the flash movie file name i will get dynamically in my code behind code.Now i want to load this file name to the flash object from code behind. Whats the ways to do this ? Is there any other method i can render a flash movie in a web page other than the OBJECT tag ?
Is there anything to do with a ajax cal here ? any performance improvement we can achieve ?
I suggest using a javascript library called SWFObject. Then, from your code behind you can register a startup script using the client script manager that loads the movie that you want.
Here is a link to the project: http://code.google.com/p/swfobject/
I would recommend that you combine client and server side code on this. It's not an extremely clean solution; however, it probably will help meet your needs.
I would recommend using jQuery and some of it's Flash Plug-ins on the client side. Then in the server I'd just RegisterClientScriptBlock that would set the properties of the flash movie as you need them.
Here's a link to a jQuery Flash Plugin

Resources