Click here to Skip to main content
15,882,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I tried this code on asp.net using file upload control
C#
if(FileUpload1.HasFile)
        {


     FileUpload1.SaveAs(Server.MapPath("~/Uploads/" +FileUpload1.FileName));
     Label1.Text=" file has uploaded sucessfully";
     Label1.ForeColor = System.Drawing.Color.Green;

     Label1.Text = System.IO.Path.GetFullPath("~/Uploads/"+FileUpload1.FileName);
        }
      else
      {
          Label1.Text="please select any file";
          Label1.ForeColor = System.Drawing.Color.Red;

when the end user clicks on print button it has to print only the selcted file,and the file has to save in server side and printing is possible on client side.. how its possible iam using Asp.net 4.5;
please send the details
Posted
Updated 1-Aug-13 1:29am
v2
Comments
Ankur\m/ 1-Aug-13 7:31am    
Is there any restriction to type of file the user uploads?

1 solution

Once you saved your file in server.i.e., after the success message "File saved successfully.. call your javascript like following..

C#
ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "javascript:yourPrintFunction()", true);
 
Share this answer
 
Comments
Member 10170389 2-Aug-13 0:48am    
When i submit that code ,it is printing the webpage ,but it has to print the user selected file...please give the solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900