Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey Everyone.
I am working in a asp.net web project, as per my client i have to perform all functions using javascript or jquery. Currently I am working on a image uploading section and also it requires to be renamed before saving.
It is required to take the filename from the file input, rename it and save it in the folder and also add this file link into the database, using javascript. Now i need help to get the filename from the input, rename it and save it and also get the path of the file getting saved.
Can any one please help me out to solve this matter?
Posted
Comments
ZurdoDev 2-Apr-12 12:44pm    
JavaScript itself cannot save a file to your server because it executes client side. It has to call server-side code. I would think you could just do the logic in C# once the file_UploadComplete event runs.

JavaScript can't do everything, you and the client should understand this. This is very easily accomplished with code-behind using SaveAs.
 
Share this answer
 
Try this once

XML
<HTML>
<HEAD>

<SCRIPT language="JavaScript">

function WriteFile()
{
   var fso  = new ActiveXObject("Scripting.FileSystemObject");
   var fh = fso.CreateTextFile("c:\\Test.bmp", true);
   fh.WriteLine("Some text goes here...");
   fh.Close();
}

</SCRIPT>
</HEAD>

<BODY>
<P>
<SCRIPT language="JavaScript">  WriteFile(); </SCRIPT>
</P>
</BODY>
</HTML>
 
Share this answer
 
v2

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