473,697 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Upload photo in asp.net content page

25 New Member
hi, good evening..
i am going to upload an image in a web form .....for that iam using HTML input(file) control and one web control button i.e., Upload_Button()
here is the code ...its work fine when iam using a normal web page... but can't in content page....

Code in Master Page
Expand|Select|Wrap|Line Numbers
  1. <%@ Master Language="C#" AutoEventWireup="true" CodeFile="submaster.master.cs" Inherits="submaster" %>
  2. <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
  3.  
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5.  
  6. <html xmlns="http://www.w3.org/1999/xhtml" >
  7. <head id="Head1" runat="server">
  8.     <title>Untitled Page</title>
  9.     <link href="css/styles.css" rel="stylesheet" type="text/css" />
  10.  
  11.       <style type="text/css">
  12.  
  13.         .modalBackground {
  14.             background-color:Gray;
  15.             filter:alpha(opacity=70);
  16.             opacity:0.7;
  17.         }
  18.     </style>  
  19.  
  20. <script language="javascript" type="text/javascript">
  21. // <!CDATA[
  22.  
  23.  
  24.  
  25. // ]]>
  26. </script>
  27. </head>
  28. <body>
  29.     <form id="form1" enctype="multipart/form-data" runat="server">   //i have added here enctype="mutipart/form-data" ... its works fine when iam writing it in normal webpage .aspx form//
  30.     <asp:ScriptManager runat="server" ID="scrpt1"/>
  31.     <div>
  32.  
  33.  
  34.  
  35. <!-- HEADER -->
  36.  
  37. <div id="inheader">
  38.  
  39. <div id="logo"><a href="#"></a></div>
  40.     <table>
  41.         <tr>
  42.             <td align="right" style="margin-left: auto; width: 775px; margin-right: auto; height: 21px">
  43.                 <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/logout.png" />
  44.                 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  45.                 &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;</td>
  46.         </tr>
  47.     </table>
  48. <%--<div id="slogan"><img src="http://bytes.com/images/slogan.jpg" alt="" width="292" height="109" /></div>--%>
  49.  
  50. <%--<ul>
  51. <li class="home"><a href="#" title="home page">home page</a></li>
  52. <li class="about"><a href="#" title="about us">about us</a></li>
  53. <li class="services"><a href="#" title="services">services</a></li>
  54. <li class="equipment"><a href="#" title="equipment">equipment</a></li>
  55. <li class="gallery"><a href="#" title="our gallery">our gallery</a></li>
  56. <li class="contact"><a href="#" title="contact us">contact us</a></li>
  57. </ul>--%>
  58.  
  59.  
  60. </div>
  61.  
  62. <table id="menutab" >
  63. <tr>
  64. <td valign="middle" >
  65. <div id="menuhead">
  66. <p>
  67.  
  68.     <span style="font-size: 14pt; color: white">&nbsp;<span
  69.         style="font-size: 13pt"><a href="default.aspx" >Home</a>&nbsp; |&nbsp; <asp:LinkButton runat="server" ID="doctor" Text="Doctor" ForeColor="white" Font-Size="13pt" Width="60px" /> |&nbsp; &nbsp;<asp:LinkButton runat="server" ID="patient" Text="Patients" ForeColor="white" Font-Size="13pt"></asp:LinkButton>&nbsp; &nbsp;|&nbsp; &nbsp;<a href="#">Diagnostic</a>&nbsp; &nbsp;|&nbsp; <a href="#">Pharmacy</a>&nbsp; &nbsp;|&nbsp; <a href="#">
  70.             Hospitals </a>|&nbsp;<asp:LinkButton runat="server" ID="Tools" Text="Tools" ForeColor="White" Font-Size="13pt" OnClick="Tools_Click" ></asp:LinkButton>&nbsp; |&nbsp; <a href="#">Blog</a> | &nbsp;<a href="aboutus.aspx">About Us</a>&nbsp;</span>
  71.  
  72. </span>
  73. </p>
  74. </div>
  75. </td>
  76. </tr>
  77. </table>
  78. <!-- CONTENT -->
  79. <div id="content" style="left: 0px; top: 0px">
  80. <asp:UpdatePanel ID="upd1" runat="server">
  81. <ContentTemplate>
  82.  <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
  83.   </asp:contentplaceholder>
  84.   </ContentTemplate>
  85.   </asp:UpdatePanel>
  86. </div>
  87.  
  88. <!-- FOOTER -->
  89.         <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" CancelControlID="btnCancel"
  90.             OkControlID="btnSignin" TargetControlID="doctor" PopupControlID="Panel1" BackgroundCssClass="modalBackground">
  91.         </cc1:ModalPopupExtender>
  92.         <cc1:ModalPopupExtender ID="ModalPopupExtender2" runat="server" TargetControlID="patient" CancelControlID="btnpCancel" OkControlID="btnpSignin" PopupControlID="Panel2" BackgroundCssClass="modalBackground">
  93.         </cc1:ModalPopupExtender>
  94.         &nbsp;
  95.  
  96. <div id="footer" style="text-align: center; left: 0px; top: 0px;">
  97. <br />
  98.     <span style="font-size: 10pt">
  99. Powered by </span><a href="http://www.meritinfo.com"><span
  100.         style="font-size: 10pt; color:#669933">Merit info Solutions</span></a><span style="font-size: 10pt">
  101.         </span>
  102. </div>
  103.  
  104.     </div>
  105.         <asp:Panel ID="Panel1" runat="server" Height="300px" Width="361px" BackColor="White" BorderColor="DarkGreen" BorderStyle="Ridge">
  106.             <br />
  107.             <br />
  108.             <br />
  109.             &nbsp; &nbsp; <span style="font-size: 12pt; color: dimgray; font-family: Arial">&nbsp;
  110.                 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <strong><span style="color: #669933">
  111.                     Already A member Log In</span><br />
  112.                 </strong></span>
  113.             <br />
  114.             <table style="width: 251px; height: 88px; margin-left:auto; margin-right:auto " cellspacing="2px" cellpadding="4px">
  115.                 <tr>
  116.                     <td style="width: 100px; height: 20px" align="right">
  117.                         <span style="font-size: 11pt; color: black; font-family: Arial"><strong>User Id</strong></span></td>
  118.                     <td style="width: 102px; height: 20px" colspan="2">
  119.                         <asp:TextBox ID="TextBox1" runat="server" Width="149px"></asp:TextBox></td>
  120.                         <td>
  121.                         </td>
  122.                 </tr>
  123.                 <tr>
  124.                     <td style="width: 100px" align="right">
  125.                         <span style="font-size: 11pt; color: black; font-family: Arial"><strong>Password</strong></span></td>
  126.                     <td style="width: 102px" colspan="2">
  127.                         <asp:TextBox ID="TextBox2" runat="server" TextMode="Password" Width="149px"></asp:TextBox></td>
  128.                         <td>
  129.                         </td>
  130.                 </tr>
  131.                 <tr>
  132.                     <td >
  133.             </td>
  134.                     <td style="width: 82px"  >
  135.             <asp:Button ID="btnSignin" runat="server" Text="Log in" />
  136.                       </td>
  137.                       <td>
  138.             <asp:Button ID="btnCancel" runat="server" Text="Cancel" /></td>
  139.                 </tr>
  140.             </table>
  141.             <br />
  142.             &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;
  143.             &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br />
  144.             &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  145.             &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
  146.             <br />
  147.             <br />
  148.             <span style="font-size: 11pt; color: black; font-family: Arial"><strong>&nbsp; &nbsp;
  149.                 &nbsp; New Doctor&nbsp;
  150.             <asp:LinkButton ID="LinkButton1" runat="server" Width="108px" ForeColor="#669933" OnClick="LinkButton1_Click">Sign Up Here</asp:LinkButton></strong></span><br />
  151.             <br />
  152.             <br />
  153.             &nbsp;<br />
  154.             <br />
  155.         </asp:Panel><asp:Panel ID="Panel2" runat="server" Height="300px" Width="361px" BackColor="White" BorderColor="DarkGreen" BorderStyle="Ridge">
  156.             <br />
  157.             <br />
  158.             <br />
  159.             &nbsp; &nbsp; <span style="font-size: 12pt; color: dimgray; font-family: Arial">&nbsp;
  160.                 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <strong><span style="color: #669933">
  161.                     Already A Member Log In</span><br />
  162.                 </strong></span>
  163.             <br />
  164.             <table style="width: 251px; height: 88px; margin-left:auto; margin-right:auto " cellspacing="2px" cellpadding="4px">
  165.                 <tr>
  166.                     <td style="width: 100px; height: 20px" align="right">
  167.                         <span style="font-size: 11pt; color: black; font-family: Arial"><strong>User Id</strong></span></td>
  168.                     <td style="width: 102px; height: 20px" colspan="2">
  169.                         <asp:TextBox ID="TextBox3" runat="server" Width="149px"></asp:TextBox></td>
  170.                     <td>
  171.                     </td>
  172.                 </tr>
  173.                 <tr>
  174.                     <td style="width: 100px" align="right">
  175.                         <span style="font-size: 11pt; color: black; font-family: Arial"><strong>Password</strong></span></td>
  176.                     <td style="width: 102px" colspan="2">
  177.                         <asp:TextBox ID="TextBox4" runat="server" TextMode="Password" Width="149px"></asp:TextBox></td>
  178.                     <td>
  179.                     </td>
  180.                 </tr>
  181.                 <tr>
  182.                     <td >
  183.                     </td>
  184.                     <td style="width: 82px"  >
  185.                         <asp:Button ID="btnpSignin" runat="server" Text="Log in" />
  186.                     </td>
  187.                     <td>
  188.                         <asp:Button ID="btnpCancel" runat="server" Text="Cancel" /></td>
  189.                 </tr>
  190.             </table>
  191.             <br />
  192.             &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  193.             &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br />
  194.             &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  195.             &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
  196.             <br />
  197.             <br />
  198.             <span style="font-size: 11pt; color: black; font-family: Arial"><strong>&nbsp; &nbsp;
  199.                 &nbsp; New Member&nbsp;
  200.                 <asp:LinkButton ID="LinkButton2" runat="server" ForeColor="#669933" OnClick="LinkButton2_Click"
  201.                     Width="108px">Sign Up Here</asp:LinkButton></strong></span><br />
  202.             <br />
  203.             <br />
  204.             &nbsp;<br />
  205.             <br />
  206.         </asp:Panel>
  207.     </form>
  208. </body>
  209. </html>
  210.  
  211.  

code of Content page:
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" MasterPageFile="~/submaster.master" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" Title="Untitled Page" EnableEventValidation="true"   %>     //......Here i have add EnableEventValidation="true"......//
  2.  
  3. <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"  >
  4.  
  5.  
  6. <div id="generalhead" style="width: 297px; height: 15px">
  7.     <span style="font-size: 12pt; color: #669933; font-family: Arial; text-decoration: underline;"><strong>Doctor Sign Up-Additional Information</strong></span>&nbsp;</div>
  8.     <br />
  9.     <br />
  10.         <table style="width: 768px; height: 147px">
  11.         <tr>
  12.         <td style="width: 291px; height: 14px; " valign="top">
  13.         <div id="box">
  14.             <table style="width: 291px; height: 195px" cellspacing="2">
  15.                 <tr>
  16.                     <td style="width: 100px" align="right">
  17.                         Qualification</td>
  18.                     <td style="width: 100px">
  19.                         <asp:TextBox ID="txtqualification" runat="server"></asp:TextBox></td>
  20.                         <td style="width: 9px">
  21.                         <span style="color:Red" >*</span>
  22.                         </td>
  23.                 </tr>
  24.                 <tr>
  25.                     <td style="width: 100px" align="right">
  26.                         Permanent Address</td>
  27.                     <td style="width: 100px" >
  28.                         <asp:TextBox ID="txtpaddress" runat="server" TextMode="MultiLine"></asp:TextBox></td>
  29.                         <td style="width: 9px">
  30.                         <span style="color:Red" >*</span>
  31.                         </td>
  32.                 </tr>
  33.                 <tr>
  34.                     <td style="width: 100px" align="right">
  35.                         Registration No</td>
  36.                     <td style="width: 100px">
  37.                         <asp:TextBox ID="txtregno" runat="server"></asp:TextBox></td>
  38.                         <td style="width: 9px">
  39.                         <span style="color:Red" >*</span>
  40.                         </td>
  41.                 </tr>
  42.                 <tr>
  43.                     <td style="width: 100px" align="right">
  44.                         Experience</td>
  45.                     <td style="width: 100px">
  46.                         <asp:TextBox ID="txtexp" runat="server"></asp:TextBox></td>
  47.                     <td style="width: 9px">
  48.                         <span style="color:Red" >*</span>
  49.                         </td>
  50.                 </tr>
  51.                 <tr>
  52.                     <td style="width: 100px" align="right">
  53.                         Upload Photo</td>
  54.                     <td style="width: 100px">
  55.                         &nbsp;<input id="filUpload" runat="server" type="file" /></td>
  56.                     <td style="width: 9px">
  57.                         <span style="color:Red" >*</span>
  58.                         </td>
  59.                 </tr>
  60.                 <tr>
  61.                     <td align="right" style="width: 100px">
  62.                     </td>
  63.                     <td style="width: 100px">
  64.                         <asp:Button id="btnUpload" runat="server" OnClick="btnUpload_Click" Text="Upload" /></td>
  65.                     <td style="width: 9px">
  66.                     </td>
  67.                 </tr>
  68.             </table>
  69.             </div>
  70.         </td>
  71.         <td style="width: 100px; height: 14px;" valign="top" align="center">
  72.         <div id="box1">
  73.             <table style="width: 291px; height: 195px" cellspacing="2">
  74.                 <tr>
  75.                     <td style="width: 100px" align="right">
  76.                         <span style="font-size: 11pt; color: dimgray; font-family: Arial">
  77.                             <asp:Label id="lblOutput" runat="server"></asp:Label></span></td>
  78.                     <td style="width: 100px">
  79.                         <asp:Image id="imgPicture" runat="server" Height="120px" Width="160px">
  80.                         </asp:Image></td>
  81.                         <td>
  82.                         </td>
  83.                 </tr>
  84.             </table>
  85.             </div>
  86.  
  87.         </td>
  88.         </tr>
  89.         </table>
  90.         <br />
  91.     <table style="width: 765px">
  92.         <tr>
  93.             <td style="width: 100px; height: 14px" align="center">
  94.                 &nbsp;<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/Submit.jpg" OnClick="ImageButton1_Click" /></td>
  95.         </tr>
  96.         <tr>
  97.         <td align="center" style="height: 21px" >
  98.             <span style="font-family: Arial"><span style="font-size: 11pt"><strong>
  99.         (<span style="color:Red">*</span>)</strong></span><span style="color:darkgray"> <span style="font-size: 11pt"><strong>These Fields are Mandatory</strong></span></span>
  100.             </span>
  101.         </td>
  102.         </tr>
  103.     </table>
  104.  
  105. </asp:Content>
  106.  

here is the code of ContentPage.asp x.cs
Expand|Select|Wrap|Line Numbers
  1.  
  2. using System;
  3. using System.Data;
  4. using System.Configuration;
  5. using System.Collections;
  6. using System.Web;
  7. using System.Web.Security;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.WebControls.WebParts;
  11. using System.Web.UI.HtmlControls;
  12. using System.Data.SqlClient;
  13. using System.Drawing;
  14.  
  15. public partial class Default3 : System.Web.UI.Page
  16. {
  17.     protected void Page_Load(object sender, EventArgs e)
  18.     {
  19.  
  20.     }
  21.     protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
  22.     {
  23.  
  24.     }
  25.  
  26.     protected override void Render(HtmlTextWriter writer)
  27.     {
  28.  
  29.         base.Render(writer);
  30.         this.Page.ClientScript.RegisterForEventValidation(btnUpload.ID);
  31.     }
  32.  
  33.  
  34.     protected  void btnUpload_Click(object sender, System.EventArgs e)
  35. {
  36.  
  37.     // Initialize variables
  38.     string sSavePath;
  39.     string sThumbExtension;
  40.     int intThumbWidth;
  41.     int intThumbHeight;
  42.  
  43.     // Set constant values
  44.     sSavePath = "http://bytes.com/images/";
  45.     sThumbExtension = "_thumb";
  46.     intThumbWidth = 160;
  47.     intThumbHeight = 120;
  48.  
  49.     // If file field isn’t empty
  50.     if (filUpload.PostedFile != null)    //.....Here iam getting filUpload which is HTML input(file) control is empty.....//
  51.     {
  52.         // Check file size (mustn’t be 0)
  53.         HttpPostedFile myFile = filUpload.PostedFile;
  54.         int nFileLen = myFile.ContentLength;
  55.         if (nFileLen == 0)
  56.         {
  57.             lblOutput.Text = "No file was uploaded.";
  58.             return;
  59.         }
  60.  
  61.         // Check file extension (must be JPG)
  62.         if (System.IO.Path.GetExtension(myFile.FileName).ToLower() != ".jpg")
  63.         {
  64.             lblOutput.Text = "The file must have an extension of JPG";
  65.             return;
  66.         }
  67.  
  68.         // Read file into a data stream
  69.         byte[] myData = new Byte[nFileLen];
  70.         myFile.InputStream.Read(myData,0,nFileLen);
  71.  
  72.         // Make sure a duplicate file doesn’t exist.  If it does, keep on appending an 
  73.         // incremental numeric until it is unique
  74.         string sFilename = System.IO.Path.GetFileName(myFile.FileName);
  75.         int file_append = 0;
  76.         while (System.IO.File.Exists(Server.MapPath(sSavePath + sFilename)))
  77.         {
  78.             file_append++;
  79.             sFilename = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName)
  80.                              + file_append.ToString() + ".jpg";
  81.         }
  82.  
  83.         // Save the stream to disk
  84.         System.IO.FileStream newFile
  85.                 = new System.IO.FileStream(Server.MapPath(sSavePath + sFilename), 
  86.                                            System.IO.FileMode.Create);
  87.         newFile.Write(myData,0, myData.Length);
  88.         newFile.Close();
  89.  
  90.         // Check whether the file is really a JPEG by opening it
  91.         System.Drawing.Image.GetThumbnailImageAbort myCallBack = 
  92.                        new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
  93.         Bitmap myBitmap;
  94.         try
  95.         {
  96.             myBitmap = new Bitmap(Server.MapPath(sSavePath + sFilename));
  97.  
  98.             // If jpg file is a jpeg, create a thumbnail filename that is unique.
  99.             file_append = 0;
  100.             string sThumbFile = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName)
  101.                                                      + sThumbExtension + ".jpg";
  102.             while (System.IO.File.Exists(Server.MapPath(sSavePath + sThumbFile)))
  103.             {
  104.                 file_append++;
  105.                 sThumbFile = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) + 
  106.                                file_append.ToString() + sThumbExtension + ".jpg";
  107.             }
  108.  
  109.             // Save thumbnail and output it onto the webpage
  110.             System.Drawing.Image myThumbnail
  111.                     = myBitmap.GetThumbnailImage(intThumbWidth, 
  112.                                                  intThumbHeight, myCallBack, IntPtr.Zero);
  113.             myThumbnail.Save (Server.MapPath(sSavePath + sThumbFile));
  114.             imgPicture.ImageUrl = sSavePath + sThumbFile;
  115.  
  116.             // Displaying success information
  117.             lblOutput.Text = "File uploaded successfully!";
  118.  
  119.             // Destroy objects
  120.             myThumbnail.Dispose();
  121.             myBitmap.Dispose();
  122.         }
  123.         catch (ArgumentException errArgument)
  124.         {
  125.             // The file wasn't a valid jpg file
  126.             lblOutput.Text = "The file wasn't a valid jpg file.";
  127.             System.IO.File.Delete(Server.MapPath(sSavePath + sFilename));
  128.         }
  129.     }
  130. }
  131.  
  132. public bool ThumbnailCallback()
  133. {
  134.     return false;
  135. }        
  136.     }
  137.  
  138.  
  139.  
Dec 24 '08 #1
3 4425
premprakashbhati
25 New Member
hi, friends...
here iam working with ContentPage of asp.net...i have to upload image file....
so,iam trying with the below code:....in which i have filUpload(HTML input(file))Con trol and a webControl button named btnUpload and an image webControl named imgPicture in which iam getting the image in thumbnail form and storing this image and thumbnail in my app folder named images
...all working fine when iam using normal webform/page not ContentPage..i have search the web ..i got answer that i have to add to <@Page of ContentPage EnableEventVali dation="true" and add the following code in aspx.cs of ContentPage....
Expand|Select|Wrap|Line Numbers
  1.  
  2. protected override void Render(HtmlTextWriter writer)
  3.     {
  4.  
  5.         base.Render(writer);
  6.         this.Page.ClientScript.RegisterForEventValidation(btnUpload.ID);
  7.     }
  8.  
but still iam not getting any value in filUpload Control ...i.e., (filUpload.Post edFile=null)
Here is my full code of MasterPage,Cont entPage.aspx (Default.aspx)a nd ContentPage.asp x.cs(Default.as px.cs)

MastePage::
Expand|Select|Wrap|Line Numbers
  1. <%@ Master Language="C#" AutoEventWireup="true" CodeFile="submaster.master.cs" Inherits="submaster" %>
  2. <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
  3.  
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5.  
  6. <html xmlns="http://www.w3.org/1999/xhtml" >
  7. <head id="Head1" runat="server">
  8.     <title>Untitled Page</title>
  9.     <link href="css/styles.css" rel="stylesheet" type="text/css" />
  10.  
  11.       <style type="text/css">
  12.  
  13.         .modalBackground {
  14.             background-color:Gray;
  15.             filter:alpha(opacity=70);
  16.             opacity:0.7;
  17.         }
  18.     </style>  
  19.  
  20. <script language="javascript" type="text/javascript">
  21. // <!CDATA[
  22.  
  23.  
  24.  
  25. // ]]>
  26. </script>
  27. </head>
  28. <body>
  29.     <form id="form1" enctype="multipart/form-data" runat="server">
  30.     <asp:ScriptManager runat="server" ID="scrpt1"/>
  31.     <div>
  32.  
  33.  
  34.  
  35. <!-- HEADER -->
  36.  
  37. <div id="inheader">
  38.  
  39. <div id="logo"><a href="#"></a></div>
  40.     <table>
  41.         <tr>
  42.             <td align="right" style="margin-left: auto; width: 775px; margin-right: auto; height: 21px">
  43.                 <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/logout.png" />
  44.                 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  45.                 &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;</td>
  46.         </tr>
  47.     </table>
  48. <%--<div id="slogan"><img src="images/slogan.jpg" alt="" width="292" height="109" /></div>--%>
  49.  
  50. <%--<ul>
  51. <li class="home"><a href="#" title="home page">home page</a></li>
  52. <li class="about"><a href="#" title="about us">about us</a></li>
  53. <li class="services"><a href="#" title="services">services</a></li>
  54. <li class="equipment"><a href="#" title="equipment">equipment</a></li>
  55. <li class="gallery"><a href="#" title="our gallery">our gallery</a></li>
  56. <li class="contact"><a href="#" title="contact us">contact us</a></li>
  57. </ul>--%>
  58.  
  59.  
  60. </div>
  61.  
  62. <table id="menutab" >
  63. <tr>
  64. <td valign="middle" >
  65. <div id="menuhead">
  66. <p>
  67.  
  68.     <span style="font-size: 14pt; color: white">&nbsp;<span
  69.         style="font-size: 13pt"><a href="default.aspx" >Home</a>&nbsp; |&nbsp; <asp:LinkButton runat="server" ID="doctor" Text="Doctor" ForeColor="white" Font-Size="13pt" Width="60px" /> |&nbsp; &nbsp;<asp:LinkButton runat="server" ID="patient" Text="Patients" ForeColor="white" Font-Size="13pt"></asp:LinkButton>&nbsp; &nbsp;|&nbsp; &nbsp;<a href="#">Diagnostic</a>&nbsp; &nbsp;|&nbsp; <a href="#">Pharmacy</a>&nbsp; &nbsp;|&nbsp; <a href="#">
  70.             Hospitals </a>|&nbsp;<asp:LinkButton runat="server" ID="Tools" Text="Tools" ForeColor="White" Font-Size="13pt" OnClick="Tools_Click" ></asp:LinkButton>&nbsp; |&nbsp; <a href="#">Blog</a> | &nbsp;<a href="aboutus.aspx">About Us</a>&nbsp;</span>
  71.  
  72. </span>
  73. </p>
  74. </div>
  75. </td>
  76. </tr>
  77. </table>
  78. <!-- CONTENT -->
  79. <div id="content" style="left: 0px; top: 0px">
  80. <asp:UpdatePanel ID="upd1" runat="server">
  81. <ContentTemplate>
  82.  <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
  83.   </asp:contentplaceholder>
  84.   </ContentTemplate>
  85.   </asp:UpdatePanel>
  86. </div>
  87.  
  88. <!-- FOOTER -->
  89.         <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" CancelControlID="btnCancel"
  90.             OkControlID="btnSignin" TargetControlID="doctor" PopupControlID="Panel1" BackgroundCssClass="modalBackground">
  91.         </cc1:ModalPopupExtender>
  92.         <cc1:ModalPopupExtender ID="ModalPopupExtender2" runat="server" TargetControlID="patient" CancelControlID="btnpCancel" OkControlID="btnpSignin" PopupControlID="Panel2" BackgroundCssClass="modalBackground">
  93.         </cc1:ModalPopupExtender>
  94.         &nbsp;
  95.  
  96. <div id="footer" style="text-align: center; left: 0px; top: 0px;">
  97. <br />
  98.     <span style="font-size: 10pt">
  99. Powered by </span><a href="http://www.meritinfo.com"><span
  100.         style="font-size: 10pt; color:#669933">Merit info Solutions</span></a><span style="font-size: 10pt">
  101.         </span>
  102. </div>
  103.  
  104.     </div>
  105.         <asp:Panel ID="Panel1" runat="server" Height="300px" Width="361px" BackColor="White" BorderColor="DarkGreen" BorderStyle="Ridge">
  106.             <br />
  107.             <br />
  108.             <br />
  109.             &nbsp; &nbsp; <span style="font-size: 12pt; color: dimgray; font-family: Arial">&nbsp;
  110.                 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <strong><span style="color: #669933">
  111.                     Already A member Log In</span><br />
  112.                 </strong></span>
  113.             <br />
  114.             <table style="width: 251px; height: 88px; margin-left:auto; margin-right:auto " cellspacing="2px" cellpadding="4px">
  115.                 <tr>
  116.                     <td style="width: 100px; height: 20px" align="right">
  117.                         <span style="font-size: 11pt; color: black; font-family: Arial"><strong>User Id</strong></span></td>
  118.                     <td style="width: 102px; height: 20px" colspan="2">
  119.                         <asp:TextBox ID="TextBox1" runat="server" Width="149px"></asp:TextBox></td>
  120.                         <td>
  121.                         </td>
  122.                 </tr>
  123.                 <tr>
  124.                     <td style="width: 100px" align="right">
  125.                         <span style="font-size: 11pt; color: black; font-family: Arial"><strong>Password</strong></span></td>
  126.                     <td style="width: 102px" colspan="2">
  127.                         <asp:TextBox ID="TextBox2" runat="server" TextMode="Password" Width="149px"></asp:TextBox></td>
  128.                         <td>
  129.                         </td>
  130.                 </tr>
  131.                 <tr>
  132.                     <td >
  133.             </td>
  134.                     <td style="width: 82px"  >
  135.             <asp:Button ID="btnSignin" runat="server" Text="Log in" />
  136.                       </td>
  137.                       <td>
  138.             <asp:Button ID="btnCancel" runat="server" Text="Cancel" /></td>
  139.                 </tr>
  140.             </table>
  141.             <br />
  142.             &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;
  143.             &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br />
  144.             &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  145.             &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
  146.             <br />
  147.             <br />
  148.             <span style="font-size: 11pt; color: black; font-family: Arial"><strong>&nbsp; &nbsp;
  149.                 &nbsp; New Doctor&nbsp;
  150.             <asp:LinkButton ID="LinkButton1" runat="server" Width="108px" ForeColor="#669933" OnClick="LinkButton1_Click">Sign Up Here</asp:LinkButton></strong></span><br />
  151.             <br />
  152.             <br />
  153.             &nbsp;<br />
  154.             <br />
  155.         </asp:Panel><asp:Panel ID="Panel2" runat="server" Height="300px" Width="361px" BackColor="White" BorderColor="DarkGreen" BorderStyle="Ridge">
  156.             <br />
  157.             <br />
  158.             <br />
  159.             &nbsp; &nbsp; <span style="font-size: 12pt; color: dimgray; font-family: Arial">&nbsp;
  160.                 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <strong><span style="color: #669933">
  161.                     Already A Member Log In</span><br />
  162.                 </strong></span>
  163.             <br />
  164.             <table style="width: 251px; height: 88px; margin-left:auto; margin-right:auto " cellspacing="2px" cellpadding="4px">
  165.                 <tr>
  166.                     <td style="width: 100px; height: 20px" align="right">
  167.                         <span style="font-size: 11pt; color: black; font-family: Arial"><strong>User Id</strong></span></td>
  168.                     <td style="width: 102px; height: 20px" colspan="2">
  169.                         <asp:TextBox ID="TextBox3" runat="server" Width="149px"></asp:TextBox></td>
  170.                     <td>
  171.                     </td>
  172.                 </tr>
  173.                 <tr>
  174.                     <td style="width: 100px" align="right">
  175.                         <span style="font-size: 11pt; color: black; font-family: Arial"><strong>Password</strong></span></td>
  176.                     <td style="width: 102px" colspan="2">
  177.                         <asp:TextBox ID="TextBox4" runat="server" TextMode="Password" Width="149px"></asp:TextBox></td>
  178.                     <td>
  179.                     </td>
  180.                 </tr>
  181.                 <tr>
  182.                     <td >
  183.                     </td>
  184.                     <td style="width: 82px"  >
  185.                         <asp:Button ID="btnpSignin" runat="server" Text="Log in" />
  186.                     </td>
  187.                     <td>
  188.                         <asp:Button ID="btnpCancel" runat="server" Text="Cancel" /></td>
  189.                 </tr>
  190.             </table>
  191.             <br />
  192.             &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  193.             &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br />
  194.             &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  195.             &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
  196.             <br />
  197.             <br />
  198.             <span style="font-size: 11pt; color: black; font-family: Arial"><strong>&nbsp; &nbsp;
  199.                 &nbsp; New Member&nbsp;
  200.                 <asp:LinkButton ID="LinkButton2" runat="server" ForeColor="#669933" OnClick="LinkButton2_Click"
  201.                     Width="108px">Sign Up Here</asp:LinkButton></strong></span><br />
  202.             <br />
  203.             <br />
  204.             &nbsp;<br />
  205.             <br />
  206.         </asp:Panel>
  207.     </form>
  208. </body>
  209. </html>
  210.  
  211.  

Here is Default.aspx(Co ntentPage)

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" MasterPageFile="~/submaster.master" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" Title="Untitled Page" EnableEventValidation="true"   %>
  2.  
  3. <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"  >
  4.  
  5.  
  6. <div id="generalhead" style="width: 297px; height: 15px">
  7.     <span style="font-size: 12pt; color: #669933; font-family: Arial; text-decoration: underline;"><strong>Doctor Sign Up-Additional Information</strong></span>&nbsp;</div>
  8.     <br />
  9.     <br />
  10.         <table style="width: 768px; height: 147px">
  11.         <tr>
  12.         <td style="width: 291px; height: 14px; " valign="top">
  13.         <div id="box">
  14.             <table style="width: 291px; height: 195px" cellspacing="2">
  15.                 <tr>
  16.                     <td style="width: 100px" align="right">
  17.                         Qualification</td>
  18.                     <td style="width: 100px">
  19.                         &nbsp;<asp:TextBox ID="txtQualification" runat="server"></asp:TextBox></td>
  20.                         <td style="width: 9px">
  21.                         <span style="color:Red" >*</span>
  22.                         </td>
  23.                 </tr>
  24.                 <tr>
  25.                     <td style="width: 100px" align="right">
  26.                         Permanent Address</td>
  27.                     <td style="width: 100px" >
  28.                         <asp:TextBox ID="txtpaddress" runat="server" TextMode="MultiLine"></asp:TextBox></td>
  29.                         <td style="width: 9px">
  30.                         <span style="color:Red" >*</span>
  31.                         </td>
  32.                 </tr>
  33.                 <tr>
  34.                     <td style="width: 100px" align="right">
  35.                         Registration No</td>
  36.                     <td style="width: 100px">
  37.                         <asp:TextBox ID="txtregno" runat="server"></asp:TextBox></td>
  38.                         <td style="width: 9px">
  39.                         <span style="color:Red" >*</span>
  40.                         </td>
  41.                 </tr>
  42.                 <tr>
  43.                     <td style="width: 100px" align="right">
  44.                         Experience</td>
  45.                     <td style="width: 100px">
  46.                         <asp:TextBox ID="txtexp" runat="server"></asp:TextBox></td>
  47.                     <td style="width: 9px">
  48.                         <span style="color:Red" >*</span>
  49.                         </td>
  50.                 </tr>
  51.                 <tr>
  52.                     <td style="width: 100px" align="right">
  53.                         Upload Photo</td>
  54.                     <td style="width: 100px">
  55.                         &nbsp;<input id="filUpload" runat="server" type="file" /></td>
  56.                     <td style="width: 9px">
  57.                         <span style="color:Red" >*</span>
  58.                         </td>
  59.                 </tr>
  60.                 <tr>
  61.                     <td align="right" style="width: 100px">
  62.                     </td>
  63.                     <td style="width: 100px">
  64.                         <asp:Button id="btnUpload" runat="server" OnClick="btnUpload_Click" Text="Upload" /></td>
  65.                     <td style="width: 9px">
  66.                     </td>
  67.                 </tr>
  68.             </table>
  69.             </div>
  70.         </td>
  71.         <td style="width: 100px; height: 14px;" valign="top" align="center">
  72.         <div id="box1">
  73.             <table style="width: 291px; height: 195px" cellspacing="2">
  74.                 <tr>
  75.                     <td style="width: 100px" align="right">
  76.                         <span style="font-size: 11pt; color: dimgray; font-family: Arial">
  77.                             <asp:Label id="lblOutput" runat="server"></asp:Label></span></td>
  78.                     <td style="width: 100px">
  79.                         <asp:Image id="imgPicture" runat="server" Height="120px" Width="160px">
  80.                         </asp:Image></td>
  81.                         <td>
  82.                         </td>
  83.                 </tr>
  84.             </table>
  85.             </div>
  86.  
  87.         </td>
  88.         </tr>
  89.         </table>
  90.         <br />
  91.     <table style="width: 765px">
  92.         <tr>
  93.             <td style="width: 100px; height: 14px" align="center">
  94.                 &nbsp;<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/Submit.jpg" OnClick="ImageButton1_Click" /></td>
  95.         </tr>
  96.         <tr>
  97.         <td align="center" style="height: 21px" >
  98.             <span style="font-family: Arial"><span style="font-size: 11pt"><strong>
  99.         (<span style="color:Red">*</span>)</strong></span><span style="color:darkgray"> <span style="font-size: 11pt"><strong>These Fields are Mandatory</strong></span></span>
  100.             </span>
  101.         </td>
  102.         </tr>
  103.     </table>
  104.  
  105. </asp:Content>
  106.  
  107.  
  108.  

Code of Default.aspx.cs (ContentPage):

Expand|Select|Wrap|Line Numbers
  1.  
  2. using System;
  3. using System.Data;
  4. using System.Configuration;
  5. using System.Collections;
  6. using System.Web;
  7. using System.Web.Security;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.WebControls.WebParts;
  11. using System.Web.UI.HtmlControls;
  12. using System.Data.SqlClient;
  13. using System.Drawing;
  14.  
  15. public partial class Default3 : System.Web.UI.Page
  16. {
  17.     protected void Page_Load(object sender, EventArgs e)
  18.     {
  19.  
  20.     }
  21.     protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
  22.     {
  23.  
  24.     }
  25.  
  26.     protected override void Render(HtmlTextWriter writer)
  27.     {
  28.  
  29.         base.Render(writer);
  30.         this.Page.ClientScript.RegisterForEventValidation(btnUpload.ID);
  31.     }
  32.  
  33.  
  34.     protected  void btnUpload_Click(object sender, System.EventArgs e)
  35. {
  36.  
  37.     // Initialize variables
  38.     string sSavePath;
  39.     string sThumbExtension;
  40.     int intThumbWidth;
  41.     int intThumbHeight;
  42.  
  43.     // Set constant values
  44.     sSavePath = "images/";
  45.     sThumbExtension = "_thumb";
  46.     intThumbWidth = 160;
  47.     intThumbHeight = 120;
  48.  
  49.     // If file field isn’t empty
  50.     if (filUpload.PostedFile != null)   .....//here iam not getting value in filUpload Control//.....
  51.     {
  52.         // Check file size (mustn’t be 0)
  53.         HttpPostedFile myFile = filUpload.PostedFile;
  54.         int nFileLen = myFile.ContentLength;
  55.         if (nFileLen == 0)
  56.         {
  57.             lblOutput.Text = "No file was uploaded.";
  58.             return;
  59.         }
  60.  
  61.         // Check file extension (must be JPG)
  62.         if (System.IO.Path.GetExtension(myFile.FileName).ToLower() != ".jpg")
  63.         {
  64.             lblOutput.Text = "The file must have an extension of JPG";
  65.             return;
  66.         }
  67.  
  68.         // Read file into a data stream
  69.         byte[] myData = new Byte[nFileLen];
  70.         myFile.InputStream.Read(myData,0,nFileLen);
  71.  
  72.         // Make sure a duplicate file doesn’t exist.  If it does, keep on appending an 
  73.         // incremental numeric until it is unique
  74.         string sFilename = System.IO.Path.GetFileName(myFile.FileName);
  75.         int file_append = 0;
  76.         while (System.IO.File.Exists(Server.MapPath(sSavePath + sFilename)))
  77.         {
  78.             file_append++;
  79.             sFilename = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName)
  80.                              + file_append.ToString() + ".jpg";
  81.         }
  82.  
  83.         // Save the stream to disk
  84.         System.IO.FileStream newFile
  85.                 = new System.IO.FileStream(Server.MapPath(sSavePath + sFilename), 
  86.                                            System.IO.FileMode.Create);
  87.         newFile.Write(myData,0, myData.Length);
  88.         newFile.Close();
  89.  
  90.         // Check whether the file is really a JPEG by opening it
  91.         System.Drawing.Image.GetThumbnailImageAbort myCallBack = 
  92.                        new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
  93.         Bitmap myBitmap;
  94.         try
  95.         {
  96.             myBitmap = new Bitmap(Server.MapPath(sSavePath + sFilename));
  97.  
  98.             // If jpg file is a jpeg, create a thumbnail filename that is unique.
  99.             file_append = 0;
  100.             string sThumbFile = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName)
  101.                                                      + sThumbExtension + ".jpg";
  102.             while (System.IO.File.Exists(Server.MapPath(sSavePath + sThumbFile)))
  103.             {
  104.                 file_append++;
  105.                 sThumbFile = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) + 
  106.                                file_append.ToString() + sThumbExtension + ".jpg";
  107.             }
  108.  
  109.             // Save thumbnail and output it onto the webpage
  110.             System.Drawing.Image myThumbnail
  111.                     = myBitmap.GetThumbnailImage(intThumbWidth, 
  112.                                                  intThumbHeight, myCallBack, IntPtr.Zero);
  113.             myThumbnail.Save (Server.MapPath(sSavePath + sThumbFile));
  114.             imgPicture.ImageUrl = sSavePath + sThumbFile;
  115.  
  116.             // Displaying success information
  117.             lblOutput.Text = "File uploaded successfully!";
  118.  
  119.             // Destroy objects
  120.             myThumbnail.Dispose();
  121.             myBitmap.Dispose();
  122.         }
  123.         catch (ArgumentException errArgument)
  124.         {
  125.             // The file wasn't a valid jpg file
  126.             lblOutput.Text = "The file wasn't a valid jpg file.";
  127.             System.IO.File.Delete(Server.MapPath(sSavePath + sFilename));
  128.         }
  129.     }
  130. }
  131.  
  132. public bool ThumbnailCallback()
  133. {
  134.     return false;
  135. }        
  136.     }
  137.  
  138.  
  139.  
Dec 25 '08 #2
Bassem
344 Contributor
1) Line 44: You don't save the file directly to http:/ some URL instead try this
string onServerPath = Request.Physica lApplicationPat h+@"Folder1\";
ImageFileUpload .SaveAs(onServe rPath + ImageFileUpload .FileName);
2)You spent a lot of code and a lot of time to open an IOStream and read/write the file, easier use SaveAs Method

3) "Between only you and me", To get immediate help type only the intended part of code not the whole project, to make others focus on the problem

Thanks
Bassem
Dec 27 '08 #3
Frinavale
9,735 Recognized Expert Moderator Expert
Hi Premprakashbhat i,

Please do not double post your questions. It makes it difficult for you to get an answer to your question. Also, please only post code relevant to the question you have because it is very hard for us to read through your code to find the few lines that you are talking about. I've merged your threads together since they are the same question.

Anyways, instead of using the HTML upload input you should look into using the .NET FileUpload Control. This control will get around the validation problem you're having and it also offers you tools that let you save the file more easily.

-Frinny
Dec 30 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

10
2876
by: matt | last post by:
I have this code, works perfectly on Windows server, but now i'm trying to run it on a Linux server, the form submits, i get no errors, but the photo doesnt upload, and the caption file doesnt write.... any ideas why?? <?php include 'gall_settings.inc';
5
3245
by: bob garbados | last post by:
I am trying to create a database-driven photo gallery for a friend with an admin form to upload images... I can upload a file to the web server, but I want to store the image in a database and I want to resize the image before I save it... How do I take the uploaded .jpg and shrink it to a thumbnail? How do I pass the uploaded .jpg to a stored procedure that will store the image as an image datatype in SQL Server 2000? I'm developing this...
15
5341
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the path of the uploaded image, and resize it with the provided dimensions. My function is below. The current function is returning an error when run from the upload function: A generic error occurred in GDI+. Not sure what exactly that means. From what...
1
2717
by: joshbeall | last post by:
Hi All, If I drop a form onto my page that allows file uploads, I know well enough how to handle the file upload in the server side via PHP. However, I have a question: when my browser actually *sends* a binary file (e.g., an image), does it encode it somehow for the upload? Or does it simply send a raw bytestream? The reason I am asking is that I am in the process of transferring some
0
4752
by: SEMIH DEMIR | last post by:
Sitelerden birinde verilen yabancı kaynakli bir scriptti duzenledim yanlız birseyin içinden bir turlu cıkamadım işin aslı ilk defa persistin upload componentini kullanacam yanlız suanki haliyle verdiği hata şu.Bilen arkadaşlar lütfen yardım edin Persits.Upload.1 error '800a0020' The system cannot find the path specified. /classifieds/upload.asp, line 250
1
1184
by: Redapple | last post by:
Hello everybody, Im a beginner in PHP and i'm thinking how i can make more things on my own made upload script: Sorry if this is the wrong forum or if its not allowed to ask for script help/reqeusts. <?php if (isset($_POST)) { if($_POST == NULL) {
21
34411
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
24
7713
by: owz2008 | last post by:
This has probably been covered before but could not find a similar thread. Basically I have created a form which can be viewed at www.icomworks.co.uk/canvaspayform.html I want to submit the form along with the file so that they are both placed on my server... I have created a folder on my server in my public_html called myscripts and have saved my upload.cgi script into that folder. my form points to that script but when I fill in the...
1
1470
by: nwclark | last post by:
I am a noobie so pleas bear with me.. I am trying to link a image to a MYSQL variable. I have user photos that i would like to link this page. So far I created an image upload and renamed the imaged to the username.jpg. Figured it would be easy to then link but nothing seems to be working. Here is the total code.. <?php require_once('../Connections/JMI10.php'); ?><?php require_once('../Connections/JMI10.php'); ?><?php...
0
8667
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8597
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9148
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9012
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8853
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7708
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4357
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4611
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3034
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.