Click here to Skip to main content
11,408,835 members (62,796 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP Javascript jQuery
Dear Friends,

I working on one page which is in Classic ASP.
I want include a file upload option in it and want to store the uploaded file in a folder.
I am planning to use jQuery for the same.
Kindly suggest is it good option or any better option is there.
Posted 7-Oct-12 19:20pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

/*Store Folder path */
hdfUploadPath.Value = "Folder Path where you want to store your file"+ "\\";

/*Creating Directory*/
if (!Directory.Exists(hdfUploadPath.Value))
{
Directory.CreateDirectory(hdfUploadPath.Value);
}

/*To get user uploaded file name*/
UploadedFile filename = UploadID.UploadedFiles[0];//"UploadID" is FileUpload ID
strGetFileName = filename.GetName();

/*Path to save user uploaded file*/
string strFileName = hdfUploadPath.Value + strGetFileName;

/*existence of file if not exists then saving else giving message to user*/
if (!File.Exists(strFileName))
{
filename.SaveAs(strFileName, true);
}
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "Error", "alert('File already exist or rename file then upload');", true);
return;
}
  Permalink  
v2
Comments
Arunprasath Natarajan at 8-Oct-12 1:35am
   
Seems to be C#, Is it Classic ASP.
If no, since the existing pages are in Classic ASP, I want to do it in same.
sanjaygajera123 at 17-Dec-12 12:49pm
   
Dear expert,
i want to upload file using ASP programming .
i have tried below code for file save on the server but it gives me an error,

<%
Set Upload = Server.CreateObject("Persits.Upload")
Upload.SetMaxSize 1048576 ' Truncate files above 1MB
Upload.Save Server.MapPath("/upload/")

%>

above code throws an error of Object creation.

please give the solution as soon as possible.

regards,
sanjay gajera
+91 89050 74894

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

  Print Answers RSS
0 OriginalGriff 390
1 Sergey Alexandrovich Kryukov 334
2 Maciej Los 155
3 PIEBALDconsult 140
4 Peter Leow 140
0 Sergey Alexandrovich Kryukov 8,676
1 OriginalGriff 6,855
2 Maciej Los 3,322
3 Abhinav S 3,238
4 Peter Leow 3,034


Advertise | Privacy | Mobile
Web03 | 2.8.150414.5 | Last Updated 8 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100