#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    27
    Rep Power
    0
    Hi:

    I wrote a file upload form where the first page allows a user to select a file for upload (so I have the normal code... input type=file...). Then comes a verification page where the user can change the info they supplied, ... after this page, my php script uploads their file.

    If I cut out the verification page, the script works file, but with it, the file can't be updated! Can I keep from deleting the /temp/var/"file" that the server makes? Does anyone know a solution (...a solution w/o frames would be prefered - but I'm open for any answer).

    Thanks,
    //ryan
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    <<
    If I cut out the verification page, the script works file, but with it, the file can't be updated!
    >>


    can you post that code here?.so we can tell you what is gone wrong in verfication page...


    ------------------
    SR -
    webshiju.com

    "The fear of the LORD is the beginning of knowledge..."
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    27
    Rep Power
    0
    This is the form (page 1)...
    ----------------------------
    (there are other fields, but I'm having no problems with them ... they use the variables: $userfile, $userfilenew, and the rest that are shown in the verification page)

    <form action="./verify.php3" method=post enctype="multipart/form-data">
    <SELECT NAME="group">
    <OPTION>Marketing</option>
    <OPTION>Engineering</option>
    </select>
    <input TYPE=file name="userfile" value="">
    <input type=submit value="continue...">
    <BR><input type=reset>


    VERIFICATION (page 2)...
    ------------------------
    (the first part is error checking... if there are errors, the script calls files: form-req1,2,3... so you can refill these fields. If you have to do that, the form is passed back to the verification page. If everything is ok, the form is passed to the 3rd page, where files are actually transfered) ($refill is a sentinel value meaning the form has errors... $error[] tracks where the error was made)

    print "<B>Your Department: </b>";
    if ($error[0]==1)
    print "<font color=red>(no selection made)</font>";
    else
    print $group;

    print "<BR><B>File for Upload: </b>";
    if ($error[2]==1)
    print "<font color=red>(no selection made)</font>";
    else
    print $userfile_name;

    if ($userfilenew && $error[2]!=1)
    {
    $userfilenew=stripslashes($userfilenew);
    print "<BR><B>New name for</b> ".$userfile_name;
    print " <B>will be</b> ";
    if ($error[3]==1)
    print "<font color=red>".$userfilenew."</font>";
    else
    print $userfilenew;
    }

    print "<BR><B>File Description: </b>";
    if($description=="")
    print "(no description)";
    else
    print $description;


    //
    //
    if ($refill>0)
    {
    print "<HR><B>errors in the form are shown in <font color=red>RED</font>.</b><BR>Please refill all of the provided boxes.";
    print "<HR>";
    print "<form action='./verify.php3' method=post enctype='multipart/form-data'>";
    //
    if ($error[0]==1) //group
    {
    require '/web/ryan/wwwroot/ryan/intranet/form-req1.php3';
    print "<HR>";
    }
    else
    print "<input type=hidden name='group' value='". $group . "'>";
    //
    if ($error[2]==1) //userfile
    {
    require '/web/ryan/wwwroot/ryan/intranet/form-req3a.php3';
    //require '/web/ryan/wwwroot/ryan/intranet/form-req3b.php3';
    print "<HR>";
    }
    else
    print "<input type=hidden name='userfile' value='" . $userfile . "'>".
    "<input type=hidden name='userfile_name' value='" . $userfile_name . "'>";
    //
    if ($error[3] == 1) //userfilenew ... don't print this twice
    {
    require '/web/ryan/wwwroot/ryan/intranet/form-req3b.php3';
    print "<HR>";
    }
    else
    print "<input type=hidden name='userfilenew' value='" . $userfilenew . "'>";

    print "<input type=hidden name='description' value='" . $description . "'>".
    "<BR><BR><input type=submit value='continue'>".
    "</form>";
    }
    else
    {
    print "<form action='./uploadtemp.php3' method=post enctype='multipart/form-data'>".
    "<input type=hidden name='group' value='". $group . "'>".
    "<input type=hidden name='userfile' value='" . $userfile . "'>".
    "<input type=hidden name='userfile_name' value='" . $userfile_name . "'>".
    "<input type=hidden name='userfilenew' value='" . $userfilenew . "'>".
    "<input type=hidden name='description' value='" . $description . "'>".
    "<input type=submit value='continue'>".
    "</form>";
    }
    ?>


    UPLOAD PAGE(page 3)...
    ----------------------
    $base_path = "/web/ryan/wwwroot/ryan/intranet/";
    $userfile = stripslashes($userfile); //need this for Windows users
    if(copy($userfile,$full_path))
    print "<B>uploading is complete.</B><br>n";
    else
    print "<B>error</B>: your file could not be uploaded.";

    --------------
    Thank you for looking at my code,
    //ryan


    [This message has been edited by snoop logy dogg (edited July 27, 2000).]

Similar Threads

  1. How do I add Combo Boxes to a form after the page is loaded?
    By assemblage in forum HTML Programming
    Replies: 2
    Last Post: February 11th, 2004, 07:47 PM
  2. Replies: 1
    Last Post: February 8th, 2004, 02:59 PM
  3. cant work out how to validate form server side properly....
    By ralphuk100 in forum PHP Development
    Replies: 21
    Last Post: February 6th, 2004, 03:35 PM
  4. cursor position on opening a form page
    By focus in forum HTML Programming
    Replies: 2
    Last Post: February 6th, 2004, 08:42 AM
  5. Validate a form using same page as form
    By annihilate in forum PHP Development
    Replies: 20
    Last Post: February 4th, 2004, 09:56 PM

IMN logo majestic logo threadwatch logo seochat tools logo