Change File name while uploading

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

Join Date: Aug 2008
Posts: 59
Reputation: love_dude1984 is an unknown quantity at this point 
Solved Threads: 2
love_dude1984 love_dude1984 is offline Offline
Junior Poster in Training

Change File name while uploading

 
0
  #1
29 Days Ago
Hi..

I want to upload a file with help of FileUpload control, in which, i want to save the file with a specific name or say a name entered in a textbox on a same page.
for ex, if textbox contains "ABC" then the files should be uploaded with abc.jpg name.

how can i restrict user to select only specific types of file in a fileupload control?

also, how can i save an image in 3 different sizes at time of uploading?

when user selects an image, it should be saved in some specific size in a specified folder with the name as in textbox,,,

Thanks,
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 44
Reputation: manishmannan is an unknown quantity at this point 
Solved Threads: 2
manishmannan manishmannan is offline Offline
Light Poster
 
0
  #2
29 Days Ago
In which language you feel comfort please reply with same post
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 59
Reputation: love_dude1984 is an unknown quantity at this point 
Solved Threads: 2
love_dude1984 love_dude1984 is offline Offline
Junior Poster in Training
 
0
  #3
29 Days Ago
hi.

I want the code in c#.net...i hav got the way to save the file with whtever name i want. i just want to know ho to store images in different size and how to use filter in fileupload control..

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 44
Reputation: manishmannan is an unknown quantity at this point 
Solved Threads: 2
manishmannan manishmannan is offline Offline
Light Poster
 
0
  #4
28 Days Ago
hii dude
you could upload a file in a folder by a random name and and the name should be store in the data base with their path
and whenever you need image you can call database path
and you got your image
thats it
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 59
Reputation: love_dude1984 is an unknown quantity at this point 
Solved Threads: 2
love_dude1984 love_dude1984 is offline Offline
Junior Poster in Training
 
0
  #5
27 Days Ago
Hey thanks..but instead of going for database, we can directly change its name in SaveAs() itself.

The only problem left is, how can i control filtering of file upload control. Is there any possible way to achieve it?
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 44
Reputation: manishmannan is an unknown quantity at this point 
Solved Threads: 2
manishmannan manishmannan is offline Offline
Light Poster
 
0
  #6
27 Days Ago
can you paste your code here !
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 16
Reputation: shibbard is an unknown quantity at this point 
Solved Threads: 2
shibbard shibbard is offline Offline
Newbie Poster
 
0
  #7
27 Days Ago
Use this in your event handler for clicking an upload button.

  1. if (FileUpLoad1.HasFile)
  2. {
  3. String fileName = "yourfilename";
  4. FileUpload1.PostedFile.SaveAs(Server.MapPath("yourpath/") + fileName);
  5. }
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 59
Reputation: love_dude1984 is an unknown quantity at this point 
Solved Threads: 2
love_dude1984 love_dude1984 is offline Offline
Junior Poster in Training
 
0
  #8
26 Days Ago
yeah..thanks..it works fine...

The only problem left is, how to filter the upload control. its possible by coding, like checking the posted file's extension, but is it anyway possible to provide facility in the upload control itself?

do reply..thanks...
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 68
Reputation: srikanthkadem is an unknown quantity at this point 
Solved Threads: 11
srikanthkadem srikanthkadem is offline Offline
Junior Poster in Training
 
0
  #9
26 Days Ago
try this
  1. if (fuResume.HasFile)
  2. {
  3. string ext = System.IO.Path.GetExtension(fuResume.PostedFile.FileName);
  4. if (ext == ".doc" || ext == ".txt" || ext == ".rtf" || ext == ".pdf")
  5. {
  6. //do something here
  7. }
  8. }
got solution ?, please mark the thread as Solved. Thanks & Regards,
srikanth kadem
srikanthkadem@rediffmail.com
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 59
Reputation: love_dude1984 is an unknown quantity at this point 
Solved Threads: 2
love_dude1984 love_dude1984 is offline Offline
Junior Poster in Training
 
0
  #10
26 Days Ago
Yeah..That works fine...

Thanks..
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
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