Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   Forum for discussion of ANTICHAT (https://forum.antichat.xyz/forumdisplay.php?f=72)
-   -   ASP.NET - Uploading files to the server (https://forum.antichat.xyz/showthread.php?t=34390)

Dracula4ever 28.02.2007 17:11

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.


Время: 20:54