1 Replies - 6269 Views - Last Post: 19 March 2012 - 06:51 AM

#1 cabbae2  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 44
  • Joined: 02-March 11

How to use uploadify in asp.net 2.0 & c# in code behind & not

Posted 24 February 2012 - 06:42 AM

Hello my names Abraham and I have a a web form that is connected to a master page. In this web form I'm trying to use the uploadify control to upload images to my database. Now this control is in a MultiView and it is the last view of the group. The problem is I want to implement the script inside my code behind and not in the generic handler. The reason why I want to do this is because I want to show a preview of the image on the site before uploading to the database using <asp:Image /> control to display it. Now my other question is their an easier way to implement this?

Here is my webform code:

<%@ Page Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeFile="solicitud.aspx.cs" Inherits="solicitud" Title="Solicitud" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<form id="frmJobs" runat="server" >
	 <div id="whiteSpace"></div>
    <asp:MultiView ID="mlvJobs" runat="server" ActiveViewIndex="0">
		<asp:View ID="vwJobImage" runat="server">
		    <div id="jobImage_Wrapper">
		            <div id="jobImage_Content">
                        <asp:Image ID="imgJob" runat="server" Height="200" Width="200" imageUrl="~/Styles/Images/stacks_image.png"/>     
                        <br />   
                        <input type="file" id="file_upload" name="file_upload" />
                        <br />
                        <asp:Button ID="btnAtras2" runat="server" Text="Atr&aacute;s" onclick="btnAtraz_Click" />

Now I removed some code that is not relevant to this and also for security measures I can't show it.

Is This A Good Question/Topic? 0
  • +

Replies To: How to use uploadify in asp.net 2.0 & c# in code behind & not

#2 Frinavale  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 205
  • View blog
  • Posts: 776
  • Joined: 03-June 10

Re: How to use uploadify in asp.net 2.0 & c# in code behind & not

Posted 19 March 2012 - 06:51 AM

Is there a reason for not using the ASP.NET FileUpload control?

As for your prieview, why don't you upload the file to your sever in a temporary directory before uploading it into your database? You'll have to implement logic to clean up the photos at an appropriate time (like when the user logs out, or their session ends, or something).

Or you could upload the images and store them into your database but put them into a temporary table that you can clean up at an appropriate time....

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1