3 Replies - 1589 Views - Last Post: 03 May 2006 - 04:40 PM Rate Topic: -----

#1 iamcenz  Icon User is offline

  • You wish you were my hand!
  • member icon

Reputation: 7
  • View blog
  • Posts: 2,442
  • Joined: 26-March 01

if/else

Posted 03 May 2006 - 11:13 AM

i got an upload feild that uploads a file and the file name is stored in the database, what is happening is when the user edits something since the upload feilds are blank it over rights it with nothing in the database. so i make hidden feilds on my form that called the file name to the hidden feilds and im trying to use the if/else to say when the upload feilds are empty use the data in the hidden feild, if they arent empty process and upload the new image.

this is what i got.

$pic1 = $_POST['pic1'];//these 4 are hidden feilds that store the data of the file name when i call it to edit.
$pic2 = $_POST['pic2'];
$pic3 = $_POST['pic3'];
$pic4 = $_POST['pic4'];


if (!empty($_FILES['ipic1'])) { //ipic1 is the name up the upload feild if its not empty

    $uploaddir = '/home/virtual/site30/fst/var/www/html/projects/';//this uploads to the dir
    $uploadfile = $uploaddir . basename($_FILES['ipic1']['name']);

   

    echo($_FILES['ipic1']['type']); 

    move_uploaded_file($_FILES['ipic1']['tmp_name'], $uploadfile);

    $pic1 = $_FILES['ipic1']['name']; //this turns it to var pic1
} 
else
     $_FILES['ipic1'] == $pic1; // if it is empty it should pull this



Is This A Good Question/Topic? 0
  • +

Replies To: if/else

#2 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: if/else

Posted 03 May 2006 - 03:20 PM

What's the problem? Is there one?
Was This Post Helpful? 0
  • +
  • -

#3 iamcenz  Icon User is offline

  • You wish you were my hand!
  • member icon

Reputation: 7
  • View blog
  • Posts: 2,442
  • Joined: 26-March 01

Re: if/else

Posted 03 May 2006 - 04:35 PM

ummm its not working lol.
Was This Post Helpful? 0
  • +
  • -

#4 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: if/else

Posted 03 May 2006 - 04:40 PM

Well as far as I know, uploading a file using HTML is pretty much a one shot deal. You can't really access the temperary files php uploads after the script has ended. (Security reasons.)

Is that what you're trying to do?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1