Mover imágenes después del envío

I have the following code : HTML :

    <title>Inserare produse in baza de date</title>
            border: 1px solid black;
    <div id="subForm" style="border:1px solid black;text-align:center;">
        <table><form action="addScript.php" methot="POST">
                <td>Produt name : </td><td><input type="text" name="name" id="name" /></td>
                <td>Product description : </td><td><textarea rows="5" cols="40" name="description" id="description"></textarea></td>
                <td>Price (USD $) : </td><td><input type="text" name="price" id="price" /></td>
                <td>Profile Picture : </td><td><input type="file" name="profilepic" id="profilepic" /></td>

                <td>Other pictures : </td><td>
                <div id="pictures" style="border:1px solid black;"><table>
                <tr><td>1</td><td><input type="file" id="pic1" name="pic1" /></td></tr>
                <tr><td>2</td><td><input type="file" id="pic2" name="pic2" /></td></tr>
                <tr><td>3</td><td><input type="file" id="pic3" name="pic3" /></td></tr>
            <td></td><td><input type="submit" value="Add" /></td>


  //connect to database
  // Check connection
if (mysqli_connect_errno())
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  //get info from form

  //move picures in image/ folder and get their path
  $moveResult=move_uploaded_file($pictmp, $path);

  $moveResult=move_uploaded_file($pictmp, $path);

  $moveResult=move_uploaded_file($pictmp, $path);


//insert info in database
$sql="INSERT INTO products ( name, description, price, profile_pic, pic1, pic2, pic3)
  echo "1 product added";


And my database looks like this :

| ID | name | description | price | profile_pic | pic1 | pic2 | pic3|*

*pic comes from picture.

The problem is this : Every time I try to submit the form, I get this error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

What have I done wrong?What am I missing?Is the PHP file wrong or what?


I found on the internet that I had set permissions to high. New I set it to 755 and I got rid of the error , but my script still doesn't work because nothing is echoed at the end.

¿Alguien tiene alguna idea?

preguntado el 05 de febrero de 14 a las 11:02

check your error log usually the log file is in /var/log/apache2/error.log or /var/log/httpd/error.log -

I found this in the log : [Wed Feb 05 14:41:23 2014] [error] [client mi IP] SoftException in Application.cpp:259: File "/home/domain/public_html/addScript.php" is writeable by group, referer: -

I have permissions to both files set to 777 -

@Denny Bejan it is not a error of code error is server side -

Yes...I have edited my post and said that I don't get the error any more, but now I get back a blank page. -

1 Respuestas

Prueba esto ...

<form action="addScript.php" methot="POST" enctype="multipart/form-data">

Respondido 05 Feb 14, 11:02

this will ensure the file to be uploaded, otherwise no $_FILES array will be created for php. - Volkan Ulukut

Parece method está mal escrito como methot. - SupervivenciaMáquina

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.