Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2010

    Question Unanswered: Why will this file upload not work?

    Hi, I am trying to create a php file upload page where JPG images can be uploaded to the server. Below are the 2 php pages that should give this functionality. For some reason it is not working. Do you have any idea as to why this file upload not work?:

    HTML Code:
    echo "<HTML>\n";
    echo "<TITLE>Upload a file</TITLE>\n";
    echo "<BODY>\n";
    echo "<form action=\"do_upload.php\" method=\"post\" enctype=\"multipart/form-data\">\n";
    echo "<P><STRONG>File to Upload:</STRONG><BR>\n";
    echo "<input type=\"file\" name=\"file\">\n";
    echo "<P><input type=\"submit\" name=\"submit\" value=\"Upload image\">\n";
    echo "<input type=\"reset\" value=\"reset\" name=\"Reset\">";
    echo "</form>";
    echo "</body>";
    echo "</html>";
    HTML Code:
    $img1_name = $_POST[img1];
    $img1_type = $_POST[file];
    echo " " . trim($img1) . "\n";
    echo " " . trim($img1_name) . "\n";
    echo "\n";
    echo "<P><HR>";
     if (is_uploaded_file($img1_name)) {
    	move_uploaded_file($img1_name, "/var/www/html/acme/$img1_name") or die("<H3><FONT COLOR=RED>ERROR 2 : (error uploading image file to portal)</H3><HR><FONT COLOR=BLACK> <LI>Couldn't copy the file. Please contact Technical Support.");
     else {
    	die("<H3><FONT COLOR=RED>ERROR 1 : (error uploading image file to portal)</H3><HR><FONT COLOR=BLACK> <LI>No input file specified. Select a file first before clicking the <I>Upload File</I> button.");
    <TITLE>Upload Status...</TITLE>
    Do you see any syntax or logic errors as to why this isn't working properly? During the 'if-else' block, it's just going to the 'die' section where it says "ERROR 1".
    Last edited by RRT; 02-28-12 at 14:58.

  2. #2
    Join Date
    Nov 2003
    Provided Answers: 8
    I don't see how this question is related to PostgreSQL?
    I just only bunch of HTML code, no SQL (and definitely no PostgreSQL specific SQL)

    Is it really that hard to find a PHP forum where this is on-topic?

  3. #3
    Join Date
    Jan 2010
    Oops, posted to the wrong forum/wrong tab opened... Sorry!!!

    Moved from pg to php forum - loquin
    Last edited by loquin; 03-02-12 at 15:13.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts