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

  • SEARCH
  • Home
  • 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 7912679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:40:09+00:00 2026-06-03T13:40:09+00:00

what i am trying to do is when an admin tries to create a

  • 0

what i am trying to do is when an admin tries to create a new product to upload to the server an image of that and as it’s name to be the product id.jpg. I have searched google with no result. The code seems to be right. Can someone help me please? I am using lamp as local test server.

<?php 
// Parse the form data and add inventory item to the system
if (isset($_POST['product_name'])) {

    $product_name = mysql_real_escape_string($_POST['product_name']);
    $price = mysql_real_escape_string($_POST['price']);
    $details = mysql_real_escape_string($_POST['details']); 
    $category = mysql_real_escape_string($_POST['category_choice']);
    $condition= mysql_real_escape_string($_POST['condition']);
    $supplier_choice= mysql_real_escape_string($_POST['supplier_choice']);
    $handling_time= mysql_real_escape_string($_POST['handling_time']);
    $weight= mysql_real_escape_string($_POST['weight']);
    $information_box= $_POST['information'];

    $pid = mysql_insert_id();
    // Place image in the folder 
    $newname = "$pid.jpg";
    move_uploaded_file( $_FILES['my_photo']['tmp_name'], "../inventory_images/$newname");


    header("location: products.php"); 
    exit();

}

?>

            <form action="add_product.php" enctype="multipart/form-data" name="my_Form" id="my_Form" method="post">


            <tr>
                <td>Φωτογραφία</td>
                <td>
                    <label>
                        <input type="file" name="my_photo" id="my_photo"/>
                    </label>
                </td>
            </tr>

            <tr>
                <td>&nbsp;</td>
                <td>
                    <label>
                        <input type="submit" name="button" id="button" value="Αποθήκευση" />
                    </label>
                </td>
            </tr>

        </table>

        </form>
  • 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. Editorial Team
    Editorial Team
    2026-06-03T13:40:11+00:00Added an answer on June 3, 2026 at 1:40 pm

    As you said, you are using lamp, check for the permission for the directory in which you are uploading file. In addition, also check for the permission for all the folder that you have mentioned in the destination path.

    The directory and all the directory in the path, in which you are uploading file must have write permission.

    If move_uploaded_file does not work then try out copy function.
    Also check for the path where you are uploading is correct.

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

Sidebar

Related Questions

I am trying to create a Wordpress MU admin plugin, that will insert some
I'm trying to create a new user on my development active directory server using
I'm new to rails, and trying to develop a system that will have several
I am trying to create an admin instance through my admins controller create action,
I'm trying to set up admin with grappelli on dotcloud services. I've got that
I have created a website from File->new-> Web Site. i am trying to go
I have a schema in an Oracle 11g R2 database that I'm trying to
I'm trying to set up a new Team Build Server for doing continuous integration,
I am trying to insert a new image into my Magento invoice or packing
I have a very complicated problem that occurs only for non-admin windows user. I

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.