| | |
Change File name while uploading
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Aug 2008
Posts: 66
Reputation:
Solved Threads: 2
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,
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,
•
•
Join Date: Nov 2009
Posts: 16
Reputation:
Solved Threads: 2
0
#7 Nov 12th, 2009
Use this in your event handler for clicking an upload button.
ASP.NET Syntax (Toggle Plain Text)
if (FileUpLoad1.HasFile) { String fileName = "yourfilename"; FileUpload1.PostedFile.SaveAs(Server.MapPath("yourpath/") + fileName); }
•
•
Join Date: Mar 2008
Posts: 68
Reputation:
Solved Threads: 11
0
#9 Nov 13th, 2009
try this
ASP.NET Syntax (Toggle Plain Text)
if (fuResume.HasFile) { string ext = System.IO.Path.GetExtension(fuResume.PostedFile.FileName); if (ext == ".doc" || ext == ".txt" || ext == ".rtf" || ext == ".pdf") { //do something here } }
got solution ?, please mark the thread as Solved. Thanks & Regards,srikanth kadem
srikanthkadem@rediffmail.com
![]() |
Similar Threads
- Change the file stream object's read position in C++. (C++)
- Change the name of a file getting downloaded (JavaScript / DHTML / AJAX)
- Need help slurping not able to change the file (Perl)
- File uploading errors (PHP)
- Product Catalogue in ASP.net 2.0 and MS access (ASP.NET)
- Having user change file locations (Python)
- how to change file name? (VB.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: Anybody Aware of Adobe Flex
- Next Thread: Calculation Event in C#?
Views: 498 | Replies: 9
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 ajax alltypeofvideos anathor appliances application asp asp.net bc30451 beginner box browser button c# cac checkbox commonfunctions complex connection dataaccesslayer database datagridview datalist development dgv dialog dropdownlist dynamically edit editing expose feedback fileuploader fill flash form formatdecimal formview google gridview gudi iis image javascript list listbox login microsoft migration mouse mssql news numerical opera panelmasterpagebuttoncontrols parent problem project radio redirect registration relationaldatabases reportemail response.redirect richtextbox rows schoolproject search security select services session sessionvariables silverlight smoobjects software sql sql-server sqlserver2005 suse textbox theft tracking treeview unauthorized validatedate validation vb.net video videos vista visualstudio web webapplications webdevelopemnt webprogramming webservice xsl youareanotmemberofthedebuggerusers





