TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
osyris zosar
NA
289
27.6k
File.CopyTo sends file to complete different directory
Apr 12 2021 6:50 AM
I am trying to upload a image using IFormFile using the following code:
//IWebHostEnvironment _webHost
string
FileName = Path.GetTempFileName() +
"_"
+ productsI.HeaderImage.FileName;
string
FilePath4 = Path.Combine(_webHost.WebRootPath,
"Images"
,
"HeaderImage"
, FileName);
using
(var stream = System.IO.File.Create(FilePath4))
{
await productsI.HeaderImage.CopyToAsync(stream);
}
It should send it to "
C:\Users\user\Desktop\Asp_net_core\Webshop\wwwroot\Images\HeaderImage
"
instead of that it is sending it to:
C:\Users\user\AppData\Local\Temp
That file path is not even close to what I have programmed C# to do
Reply
Answers (
4
)
SignalR connection disconeected when browser is minimized
looping in c#,net in winform