Показать сообщение отдельно

ASP.NET - Uploading files to the server
  #1  
Старый 28.02.2007, 17:11
Dracula4ever
Постоянный
Регистрация: 08.05.2006
Сообщений: 559
Провел на форуме:
1593567

Репутация: 354


По умолчанию ASP.NET - Uploading files to the server

A while ago I answered a question about uploading files from an ASP.net application on walla.co.il … So here is the tip:

To let your users upload files from their computer to the server you can use a great contol called “FileUpload” control.

To use the control, just put the code below into the POST event and the file that the user asked to upload will be uploaded to the server: (Note: oFile is the FileUpload control)

PHP код:
if (oFile.PostedFile != null)
{
string fullFileName oFile.PostedFile.FileName//getting the path
string fileName System.IO.Path.GetFileName(fullFileName); //getting the 
filenameoFile.PostedFile.SaveAs(Server.MapPath(string.Empty) + \\” fileName); //saving the file on the demand directory on the server file system

Note: this code checks if a file was really sent before trying to save it.

Последний раз редактировалось Dracula4ever; 03.03.2007 в 09:08..
 
Ответить с цитированием