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

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2007
Posts: 14
Reputation: sasindagi is an unknown quantity at this point 
Solved Threads: 0
sasindagi sasindagi is offline Offline
Newbie Poster

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

 
0
  #1
Jul 19th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 216
Reputation: jamello is an unknown quantity at this point 
Solved Threads: 6
jamello's Avatar
jamello jamello is offline Offline
Posting Whiz in Training

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

 
0
  #2
Jul 27th, 2007
Can the user successfully upload his files?
New folders can be created. Confirm and get back to me
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 14
Reputation: sasindagi is an unknown quantity at this point 
Solved Threads: 0
sasindagi sasindagi is offline Offline
Newbie Poster

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

 
0
  #3
Jul 28th, 2007
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC