Reply to Re: Doesn't work on my linux !

Re: Doesn't work on my linux ! new!
by lovighi, 12 years, 4 months ago
I try again with this sample, it don't work...

include 'class.upload.php';

if (isset($_POST['ajouter_sponsor'])) {

  $foo = new Upload($_FILES['image_sponsor']);
  if ($foo->uploaded) {
    // save uploaded image with no changes
    $foo->Process('js');
    if ($foo->processed) {
      echo 'original image copied';
    } else {
      echo 'error : ' . $foo->error;
    }
    // save uploaded image with a new name
    $foo->file_new_name_body = 'foo';
    $foo->Process('js');
    if ($foo->processed) {
      echo 'image renamed "foo" copied';
    } else {
      echo 'error : ' . $foo->error;
    }
    // save uploaded image with a new name,
    // resized to 100px wide
    $foo->file_new_name_body = 'image_resized';
    $foo->image_resize = true;
    $foo->image_convert = gif;
    $foo->image_x = 100;
    $foo->image_ratio_y = true;
    $foo->Process('js');
    if ($foo->processed) {
      echo 'image renamed, resized x=100
      and converted to GIF';
      $foo->Clean();
    } else {
      echo 'error : ' . $foo->error;
    }
  }
}

<form action="" enctype="multipart/form-data" method="post" >
<label>Choisir une image</label>
<input type="file" name="image_sponsor">
<button type="submit" name="ajouter_sponsor">Ajouter</button>
</form>

Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important