David Powers Lesson10 - "does not meet the requirements of an image.

Hello

I have a problem to download lesson10 image. It still shows the error message "not satisfying the requirements of an image" even the size of the image, the width and height to meet validation. This is upload_images.php

My download file size is 160K with 640 pixels wide and 480 pixels high. Help, please. Thank you.

upload_images.php

----------------------

<? PHP

$uploader = new Zend_File_Transfer_Adapter_Http();

$uploader-> setDestination ($destination);

$uploader-> setOptions (array ('ignoreNoFile' = > TRUE));

$files = $uploader-> getFileInfo();

$filenum = 1;

foreach ($files as $file = > $info) {}

$file = 'picture {$filenum} ";

$caption = $_POST ['caption {$filenum}"];

If (isset($_POST["place_id{$filenum}"])) {}

$place_id = $_POST ['place_id {$filenum}"];

} else {}

$place_id = NULL;

}

$filenum ++;

If ($uploader-> {isUploaded ($file))}

$filename = $uploader-> getFileName ($file, FALSE);

$uploader-> addValidator ('Size', FALSE, 500 kB');

$uploader-> addValidator ('MIME Type', FALSE, 'image');

$uploader-> addValidator ('ImageSize', FALSE, array ('minheight' = > 50, "minwidth" = > 100 "));

{If (! $uploader-> {isValid ($file))}

$errors [$filename] = "$filename does not meet the requirements of an image;

} else {}

$no_spaces = str_replace (' ', '_', $filename, $renamed);

$uploader-> addValidator ('Extension', FALSE, 'gif, png, jpg');

$recognized = FALSE;

If ($uploader-> {isValid ($file))}

$recognized = TRUE;

} else {}

$mime = $uploader-> getMimeType ($file);

$acceptable = array ('jpg' = > ' image/jpeg')

'png' = > ' image/png ',.

('gif' = > ' image/gif');

$key = array_search ($mime, $acceptable);

If (! $key) {}

$errors [$no_spaces] = "$filename is an unrecognized image type";

} else {}

$no_spaces = "$no_spaces." $key ';

$recognized = TRUE;

$renamed = TRUE;

}

}

If {($recognized)

get the names of existing files

$existing = rewinddir(3) ($destination);

check if the name of the downloaded file is in the table

If (in_array ($no_spaces, $existing)) {}

get the position of the last period

Use it to get the base name and extension

$dot = strrpos ($no_spaces, '.');

$base = substr ($no_spaces, 0, $dot);

$extension = substr ($no_spaces, $dot);

initialize a counter

$i = 1;

use a loop to add the counter after database name

check if the new name exists in the table

{}

$no_spaces = $base. '_' . $i++ . $extension;

} While (in_array ($no_spaces, $existing));

$renamed set to true

$renamed = TRUE;

}

$uploader-> clearValidators();

$uploader-> addFilter ('Rename', array ('target' = > $no_spaces, $info ['tmp_name']));

$success = $uploader-> receive ($file);

If (! $success) {}

$errors [$no_spaces] = implode('.) (', $uploader-> getMessages());

} else {}

$uploaded = '$filename downloaded successfully ';

If {($renamed)

$uploaded. = "and renamed $no_spaces.

}

$images [] = array ('name' = > $no_spaces,)

'caption' = > $caption,

('place_id' = > $place_id);

$messages [] = $uploaded;

}

}

}

}

}

I finally solved it. For your information, I use php version 5.4.3 and MAMP 2.2. Here are the changes:

(1) open the php.ini file

Search for "extension = php_fileinfo.dll" and delete.

(2) download the package files GNU for windows http://gnuwin32.sourceforge.net/downlinks/file-bin-zip.php.

Extract the zip file.

(3) copy 2 of the file in the extracted, folder/share/file/Magic and... /share/file/Magic.MGC and paste in the folder extra/php/magic

folder. (Create the magic folder in the new folder).

(4) stop MAMP all services and services to start.

It will work for you!

Tags: Dreamweaver

Similar Questions

Maybe you are looking for

  • Equation of Bhaskara

    Hello I'm trying to understand how things works in HP first and I'm putting the complete (if possible) equation of Bhaskara, in order to get results for x' and x 'at the same time. Not use an equation for one and one for the x. second if possible at

  • Satellite A100-626 - maximum memory supported?

    Hello I have a Satellite A100-626 with 2 GB of RAM. As indicated in the record of this model:standard: 1 024 (512 + 512) MBmaximum extension: 4 096 MBtechnology: DDR2 RAM (533 MHz)expansion module sizes: 256, 512, 1 024 MB It is said that it can go u

  • Question of the user defined Type (UDT)

    Hello The attached file is NEITHER sample to call a VB6 vi. The following is declared in the declaration section: ' Global declarationsDim lvapp As LabVIEW.ApplicationDim vi LabVIEW.VirtualInstrument When I paste these statement in another project (t

  • Remote Desktop, response delayed when typing using the SHIFT key

    I have a laptop running Vista professional that I used to connect (DSL) to a desktop computer using remote desktop (XP) work.  Several months ago, I started noticing a response delayed when typing using the SHIFT key. For example my name, Garth, migh

  • Download Windows 7 home basic oem and install

    I have window 7 product key for pre-installation home base but foolishly, I install window 8.1 but I don't have the product keys. Please help me to download Windows 7 OEM home base.