// Make sure we were able to determine a proper // extension if (null == fileExt) return "No file";
// Check if the directory we are saving to exists if (!Directory.Exists(FilesPath)) { // If it doesn't exist, create the directory Directory.CreateDirectory(FilesPath); }
//// Set our full path for saving var path = Path.Combine(HttpContext.Current.Server.MapPath("~/Content/SupplyUpload"), fileName);
if (File.Exists(path)) return "The file has already been uploaded!";
// Save our file
file.SaveAs(path);
// Return the filename return fileName;
} public static void DeleteFile(string fileName) {
// Set our full path for deleting var path = Path.Combine(HttpContext.Current.Server.MapPath("~/Content/SupplyUpload"), fileName);
// Don't do anything if there is no name if (fileName.Length == 0) return;
Tak for dit svar, jeg flg meddelse, som jeg ikke kan bruge til meget:
Server Error in '/' Application. --------------------------------------------------------------------------------
Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
Du kan jo prøve at gøre hvad der står - altså sætte customerrors mode til off i din web.config. Alternativt må du have en log du kan kigge i - eller du fanger fejlen i en try/catch og udskriver den pænt til skærmen.
Alt afhængig af udbyder kan du måske selv give rettigheder. Hvis App_Data fx har været slettet kan det være årsagen til de manglende rettigheder.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.