Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 168479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:27:39+00:00 2026-05-11T12:27:39+00:00

I am allowing users of the admin panel of my website to upload photos,

  • 0

I am allowing users of the admin panel of my website to upload photos, its a simple process where I check the validity of the image and then save it to a folder, then I also have to record a couple of database records for that image to be able to retrieve it later, my saving function is as follows… The function that uploads and saves the picture in the folder with a name i construct in another function:

My_HTMLInputFile.PostedFile.SaveAs(HttpContext.Current.Server.MapPath('~/photos\' & pta.FileName)) 

And the function that creates the database record for that same picture:

Public Function InsertPhoto() As Integer         Dim pta As New GKPTableAdapters.tblPhotosTableAdapter         Return pta.InsertPhoto(PhotoCaption, PhotoDescription, ('http://www.myURL.com/photos/' & FileName), IsDefault, IsPicture)     End Function 

Now I know that what I am doing is full of best-practices violations, so please point me out to what I should do, keep in mind that the users might delete the pictures later, so I wanna make sure that I can delete the database and file of the picture, and the whole issue of the path is confusing me 😛

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T12:27:40+00:00Added an answer on May 11, 2026 at 12:27 pm

    Something I’ve noticed right off the bet is that you are hardcoding the FULL PATH to the image.

    I’d just store the image name, and then prepend the relative path when i display it in the application

    If you allow your users to delete the files via your application, you should delete the record in the database, and then delete the file itself by using File.Delete method

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 73k
  • Answers 73k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer If your email template can be less than 2000 characters… May 11, 2026 at 2:02 pm
  • added an answer You could use explode, split or preg_split. explode uses a… May 11, 2026 at 2:02 pm
  • added an answer You should check out S#arp Architecture. Comes with a VS… May 11, 2026 at 2:02 pm

Related Questions

I am allowing the users to be able to make their own font choices
For a project I am currently working on, I am interested in allowing users
I am working on localization for a asp.net application that consists of several projects.
I am looking for good methods of manipulating HTML in PHP. For example, the
I am aware that in .NET there are three timer types (see Comparing the
I'm in the process of building a back-end admin panel for a site and
My company is building an ASP.NET HR application and we have decided to create
I am working on a product that runs an SQL server which allows some

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.