944,156 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 1616
  • ASP.NET RSS
Jul 19th, 2007
0

how to store the uploaded txt or .doc or jpg file in to webserver by dynamically

Expand Post »
how to create new folder for each user who uploads .doc,.txt,.png,.jpg into web server. user may select his own type of uploads file depending upon file extension new folder must be created.
eg: user wish to upload a .doc file
then i want to create dynamically
http://localhost/test/user1/doc/xyz.doc
test- name of project
user1-user name who has uploaded
doc- folder name becoz .doc file uploaded
xyz.doc- name of the file
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sasindagi is offline Offline
14 posts
since Jun 2007
Jul 27th, 2007
0

Re: how to store the uploaded txt or .doc or jpg file in to webserver by dynamically

Can the user successfully upload his files?
New folders can be created. Confirm and get back to me
Reputation Points: 215
Solved Threads: 6
Posting Whiz in Training
jamello is offline Offline
219 posts
since Oct 2006
Jul 28th, 2007
0

Re: how to store the uploaded txt or .doc or jpg file in to webserver by dynamically

am creating new folder for each user who uploads any files. all the uploaded files will be in that folder.
here is sample
//file upload

if ((FileUpload1.PostedFile != null) && (FileUpload1.PostedFile.ContentLength > 0))
{
System.IO.Directory.CreateDirectory(Server.MapPath("Upload" + "/" + Request.Cookies["uname"].Value.ToString()));
string a;
string fn = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
SaveLocation = "Upload" + "/" + Request.Cookies["uname"].Value.ToString() + "/" + fn;
a = Server.MapPath("Upload" + "/" + Request.Cookies["uname"].Value.ToString()) + "/" + fn;
try
{
FileUpload1.PostedFile.SaveAs(a);
}
catch (Exception ex)
{
Response.Write("Error: " + ex.Message);

}

}
here above code is used to create a new folder with his name.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sasindagi is offline Offline
14 posts
since Jun 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Web Service
Next Thread in ASP.NET Forum Timeline: How to disable tab stop on datagrid headers?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC