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
Bhavesh Vankar
761
1.1k
88k
Recapture Image error
Sep 7 2020 5:57 AM
By Recapture image occur error "The process cannot access the file because its used by another process."
my code is below i try to delete existing file but not successed.
[WebMethod()]
public
static
bool
SaveCapturedImage(
string
data)
{
string
fileName = DateTime.Now.ToString(
"dd-MM-yy hh-mm"
);
//string fileName2 = DateTime.Now.ToString("dd-MM-yy hh-mm");
//Convert Base64 Encoded string to Byte Array.
//if (File.Exists(fileName2))
//{
// File.Delete(fileName2);
//}
//else
//{
byte
[] imageBytes = Convert.FromBase64String(data.Split(
','
)[1]);
//Save the Byte Array as Image File.
string
filePath = HttpContext.Current.Server.MapPath(
string
.Format(
"~/CapturedImage/{0}.jpg"
, fileName));
File.WriteAllBytes(filePath, imageBytes);
return
true
;
//}
Reply
Answers (
0
)
C# Crop Image Code
Retrieve image from folder to Image Control