I want to upload the resume into SQL server from ASP.net. I want to just upload the doc files.Can somebody give idea,how to do that?
Printable View
I want to upload the resume into SQL server from ASP.net. I want to just upload the doc files.Can somebody give idea,how to do that?
this will do ...if not let me know exception...Code:protected void Button1_Click(object sender, EventArgs e)
{
String fileExtension = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();
//Response.Write(fileExtension.ToString());
if (fileExtension.ToString() == ".doc")
{
try
{
FileUpload1.SaveAs(Server.MapPath("~/DOCS/" + FileUpload1.FileName.ToString()));
Response.Write("File Uploaded Successfully..");
}
catch (Exception ex)
{
Response.Write("Your Error" + ex.Message.ToString());
}
}
else
{
Response.Write("Please Upload Only DOC files..");
}
}
hope that helps
Hey sonia,
Can you perhaps provide some more information as to your exact requirement? Are you allowing people to log into your website? Do you need to relate the resume that is being uploaded to their user profile? Or are they simply being uploaded, and someone is being notified of the upload?
Here is the documentation for the FileUpload Control:
http://msdn.microsoft.com/en-us/libr...ileupload.aspx
Gary
hello gep Sir, I m developing a job site on which users can upload resume. I think so that resume is saved in DATABASE na???If i m not wrong or u advice me what to do???????
There are various file formats a user can choose to build and upload his resume. Everyone doesnot have doc editors (e.g. Ms Word etc.) on their system. So they may also choose to save it as plain text file (*.txt), or in rich text format (.rtf), *.pdf etc.
I suggest you allow most formats except for executable formats like *.exe, *.bat, *.vbs, *.js etc. which are dangerous.
Moreover, if you accept files and do nothing with it, it's useless. You can't search anything in them (programatically) as each resume will be in different format. So storing them in a database don't do much good. What most job websites do is accept file from user;The file then goes to a data-entry operator who fills the various elements of the resume into the database using the data-entry screen provided. This data is now well formatted and can be queried using sql queries.
Hello thx to all.
I save the resumes that are uploaded ,in a folder. Suppose I save all the resume in Server.MapPath(~Users/Resumes) Folder. Suppose first user selects file C:\Resume.doc. Now on File Upload- File named Resume.doc,save to my Resumes Folder. Now suppose second user selects file D:\Resume.doc,In that case what to do??? First file is overwritten by the user???? So what to do to avoid this????? Check the FileNames????
While saving the files add the datetime stamp to the name so that there is no duplication.
Do something like this sample. (Note that I used Response.Write to show the status for demo purposes; however the ideal way is to show it in label etc.)
vb.net Code:
Private ValidFileTypes() As String = {"text/plain", "application/msword"} '<-- Add more valid filetypes here Private Sub UploadFile() '' check if we support this file format If validFileTypes.Contains(FileUpload1.PostedFile.ContentType) Then '' Upload file to server Dim FileName As String FileName = String.Format("{0:yyyyMMddHHmmssff}-{1}", Now, FileUpload1.FileName) FileUpload1.SaveAs("C:\Temp\" & FileName) '<-- replace with appropriate path '' make approrpiate entry about this filename etc. into the database here Response.Write("File upload successful.") Else Response.Write("This file type is not supported by our website.") End If End Sub
Hey,
As an alternative suggestion, you might want to think about appending the IP address of person who is logged in and uploading the file to the name.
I agree with Pradeep on the location of the uploaded files. I don't see any benefit in storing them in the database. Upload them into one place, and place a "pointer" to the file in the database.
Gary
Hey,
In terms of the same person uploading two files, then in this case, I would expect an overwrite to happen, since why would the same person have two resume's? An upload of the same filename would be regarded as an update to the resume.
Gary
Most of the job sites now allow more than one resume profile for each person. e.g. When I'm applying for a Project Manager, I might want to format my resume differently than what I would do for Software Developer etc.
Hey,
Ah, that's a good point.
Just shows my lack of knowledge in that area, I have never used a Online Resume site :)
Gary
Personally I would make job seekers paste their resume into a rich text editor apply some formatting and save it as a text field in the database or a pdf file or whatever. That way you control the format/ type of file.
Maybe that's to much effort to go to though, just a suggestion.