ASP.NET uploading image with just button click - asp.net

Is there any controls that I can download that allows a user to upload images with just a button click and be able to open the file dialog. I do not want to use the fileupload control.

If you're looking for something with better asthetics, Steve Sanderson has a nice Ajax uploader with a progress bar you can check out. Pretty straightforward installation.
http://blog.stevensanderson.com/2008/11/24/jquery-ajax-uploader-plugin-with-progress-bar/

According to me: no. It would open a security hole as if you don't let an enduser decide which file to select from his/her drive an application would be able to leech anything from that drive.
The ASP.NET fileupload control itself simply renders to an <input type="file"> html element. How the browser renders that is up to the browser. However it can be styled. For example like this: http://www.quirksmode.org/dom/inputfile.html.
If it's on a corporate LAN and there's a certain file on a users drive and (s)he opens your page then you might want to use something like a custom written ActiveX control which can be embedded in the rendered html to perform the task.
A variant on this one would be to create a winforms user control, embed that into the rendered html (a so called smart client), with enough CAS settings on the client pc to be able to do this.

Related

how to create a pop up window #2

is there a way to create a pop-up window in a VB.Net application, specifically when a button has been clicked?
I'm designing a little help section on a web application I'm working on, and I wanted to have a variety of written steps followed by some sort of "Click here for an example" button that brings up a new window (not a new page, just a new window). The window would simply contain an image control displaying a picture that describes the written steps.
The best example I can come up with is here on Amazon when ordering a clothing item such as a pair of shoes. When the user clicks the "Sizing Info" link button, a pop-up window appears with information to help you order the correct size.
So is there a way to create a pop up like that in VB.Net?
In vb.net not, websites are handled differently. For displaying a popup using asp.net you need a client-side language, like javascript.
For instance this nice jquery script http://jqueryui.com/dialog/
Your vb.net can't open dialogs on client-side. If you need to get/send some information from the server, simply use webservices to send/fetch the information using ajax.

Adding lightbox (or something similar) to ASP.NET project

I need to implement some, let's call it "dialog" in some old ASP.NET project that I took over. It's huge project so I'm not allowed to implement new things.
I have a form on which user can attach up to 3 file attachments, enter some 10-15 fields, and when required fields are filled, submit button get's enabled.
What need to be done is press submit, wait for any possible response for server, and then display some sort of dialog, alert, lightbox which would display short summary and list of correctly uploaded files.
What would be the best approach to do this in ASP.NET?
Considering jQuery Lightbox is designed for overlaying images rather than HTML I would recommend using FancyBox or FaceBox instead.

Facebook like button with silverlight

I have created a silverlight app that consits of like buttons within specific usercontrols (all in one asp page). Ie.
foodingtons.net/index.aspx?id=211
It is all incorporated within the silverlight app on one page. Hence when the control is loaded the meta tags are updated and the like button is placed within an iframe and linked to the appropriate page. When the like button is pressed a javascript function is invoked which changes a picture behind the silverlight obj. This picture in theory should be used as the default image after the like button is pressed (on clients page). But it seems to be stuck on old images.
Ie.
foodingtons.net/index.aspx?id=211
(the above is using an image which doesnt even exist)
foodingtons.net/index.aspx?id=218
(is using an image from the main page)
foodingtons.net/index.aspx?id=219
(fails.. the website is inaccessable)
I have also tried create the open graph tags with in the page to reference new images but to no avail.
I'm using the following facebook tool to debug as well
https://developers.facebook.com/tools/debug
a bit lost ... any suggestions?
Take a look at Add Facebook Like to your Silverlight Application.
Worked out what was going on. Facebook and google (using their bots) cannot crawl into the silvelright control itself. So they cannot invoke the functions that will get the meta and pics changing. Had to call the change meta stuff from the asp page itself. All sorted.

ajax image upload and preview in asp.net

i have created a webform.in that there is file upload.
i want to upload the image and show the thumbnail image on fileupload select,and On page submit i want to save the image path to database.
how can u implement it using ajax.
Thanks in advance.
Strictly speaking there is no way to implement an actual ajax file upload as its not supported by browsers. Html 5 has a lot more stuff you can do with file uploads.
You can implement your own hack using iframes, I have done this before. Basically you have an iframe that just has a form with the fileupload control on it and auto submit the form then call out to the parent window to update it when complete.
Alternatively use a pre built control something like the telerik one, you should be able to find a free one. http://www.telerik.com/products/aspnet-ajax/upload.aspx.

How not to upload file on submit

I have a form in asp.net with a FileUpload control inside. Next to this control I have "Upload" button which is used to upload a file to a list of files. The problem is that I also have "Submi"t button used for submiting whole form.
Now when somebody selects a file through browse button and presses on "Submit" not "Upload" file is being uploaded and I wouldn't want that.
I'm hoping for asp.net or general HTML answer
Sounds like the FileUpload control and Upload button should be inside it's own form. With ASP.NET and the 1 server-side form restriction, you may have to resort to regular HTML controls to do this.
Alternatively, you may be able to use JavaScript to clear the FileUpload if Upload isn't clicked. Browsers can be picky about access to file inputs, though (for security reasons) so it may not be accessible.
For the general HTML answer, have your file upload button be part of a separate form from the other form, meaning they are encapsulated within separate Form tags.
For ASP.NET, you're going to have more pain, since ASP.NET by default has only one form per page.
Ultimately, however, I think you're better off rethinking your design. Try to put that file upload on a separate page; if you have a page that does more than one thing, you're inviting confusion on the part of the user.
Submit button will send all of the form's information.
Try putting the FileUpload control outside, on a diferent form.
Your FileUpload control needs to be in its own form if you want to to be submitted separately. When you click the Upload button, the other parts of your form are being submitted as well. That's just how it works.
I would separate the two forms. Using JavaScript or something like that could get to be a pain. The problem with separating the forms is you have to do it in a way where you don't lose your original form, meaning if you have other form information around the file upload you might have a bit of a nightmare on your hands but if you can put the file upload either above or below the form that submit controls then it's easy.
<form id="A">
<button name="submit>
</form>
<form id="B">
<fileupload>
</form>
I use this method on one of my sites and it works quite well.

Resources