C# Image Problem

when I save a record with Image, it will save perfectly but when I updated the record again for Image it will say System.IO.IOException: "The file exists" on windows 7 64 bit . The installation directory is with read only attribute , I tried the best to remove this attribute but could not make it.
Can u help me out
Mahen SinghAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mahen SinghAuthor Commented:
0
Gustav BrockCIOCommented:
Modify your Save method to first delete an existing file, then save the new/modified image file.

Of course, if you are granted read-only rights only, you are hosed. If so, use another install and/or work directory where the user has full rights. The recommended location is a subfolder under %localapppath%.

/gustav
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mahen SinghAuthor Commented:
I am doing in same way.. but in some cases this error occurs ....I have also attached the screenshot
0
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

Gustav BrockCIOCommented:
Well, the program files folder is definitely not the place to store user files, so try playing by the rules and use %localapppath%.

/gustav
0
Mahen SinghAuthor Commented:
Can u explain it with detail.. did not get your point exactly..?
0
Gustav BrockCIOCommented:
Try to save your files in a sub folder of the %localappdata%.

The Program Files folder is not intended for this purpose.

/gustav
0
Mahen SinghAuthor Commented:
There must be solution.. I think , if we install on client machine it would be installed on program file directory..
0
Gustav BrockCIOCommented:
No. Normal user rights doesn't grant right to save anything in the Program Files folder. You need Admin rights, and a normal user should never be required to run your application with admin rights.

It's up to you to control the installation.
0
Mahen SinghAuthor Commented:
k.. then how to give the rights to normal user ....like admin rights. In that case it wont be a prob.
0
Gustav BrockCIOCommented:
You can set your application to require admin rights. That will pop the usual warning message and ask the user for credentials for an admin account.
But to save some pictures, this is bad practice and should be avoided. Again, use %localappdata% for storing user documents and files.

/gustav
0
Gustav BrockCIOCommented:
Question was answered.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Installation

From novice to tech pro — start learning today.