פורסם 2012 במאי 1913 שנים שלום,אני בונה אתר ב - ASP.NET ויש לי בעית גישת בהעלאת קובץ לשרת. ברגע שהלקוח מנסה לעלות את הקובץ לשרת אז התוכניתנופלת בגלל בעית גישה. מצורפת תמונה לחריגה. צרפתי גם את הקוד. עזרתם תודה. protected void B_upload_Click(object sender, EventArgs e) { if (myFile.PostedFile != null) { // File was sent // Get a reference to PostedFile object HttpPostedFile upFile = myFile.PostedFile; // Get size of uploaded file int nFileLen = upFile.ContentLength; // Allocate a buffer for reading of the file byte[] myData = new byte[nFileLen]; // Read uploaded file from the Stream upFile.InputStream.Read(myData, 0, nFileLen); WriteToFile("C:/", ref myData); } else { // No file } } protected void WriteToFile(string strPath, ref byte[] Buffer) { // Create a file FileStream newFile = new FileStream(strPath, FileMode.Create); // Write data to the file newFile.Write(Buffer, 0, Buffer.Length); // Close file newFile.Close(); }
ארכיון
דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.