コード例 #1
0
    5. photos are resized using resize image if they exist
    6. all values from form are inserted into db, using poster provided image names
    7. now an item_id is created in the db for this record
    8. the item_id is retreived and used to create a name for the image of format
        'imageA10.jpg, imageB10.jpg, and imageC11.jpg' and the customer image names
         in the photos directory are overwritten with these new names.  The customer
         provided photo names inthe db are overwritten with the new format names.
         I was concerned about having an easy way to tie together images in the photos 
         directory with the record inthe db they belong to.  ***/
 //     if ($_FILES["fileToUpload1"]["size"] > 500000) {
 //      echo "I think the file is tooooo big";
 //   }
 //check each potential upload file for size < 500K and only jpg accepted
 $photoErr1 = checkSizeType("fileToUpload1");
 $photoErr2 = checkSizeType("fileToUpload2");
 $photoErr3 = checkSizeType("fileToUpload3");
 // list($width, $height, $type, $attr) = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
 // printf("width is: %d height is :%d\n", $width, $height);
 //printf("type is : %s.\n", $type);
 //printf("attribute is : %s.\n", $attr);
 //below gets array of info from the file temporarily stored on server
 //*****************problem with photo, size type, reject & error message**
 // Check if $fail is set to true (too big or not jpeg), if not upload the file
 if ($fail == 'true') {
     //should default to form here and display error message for field that failed
 } else {
     //need to move into section below for if $fail = 'false'
     //this is where the file is moved from special area to real file
     //$imageName is file name provided by the user: userfilename.jpg
     //$target_file file name provided by user with path added:  photos/userfilename.jpg
     //the if statements below are a fix for the ios (ipad, iphone) problem of calling all
コード例 #2
0
ファイル: postItem.php プロジェクト: salexa/RHE
     $photoCnt = $photoCnt + 1;
 }
 if (empty($_POST["fileToUpload3"])) {
     $fileToUpload3 = "empty";
 } else {
     $fileToUpload3 = test_input($_POST["fileToUpload3"]);
     $photoCnt = $photoCnt + 1;
 }
 //check each potential upload file for size < 500KB
 //check for != 'empty' here (need to fix code above to set 'empty')
 $string1 = "fileToUpload1";
 $photoErr1 = checkSizeType($string1);
 $string1 = "fileToUpload2";
 $photoErr2 = checkSizeType($string1);
 $string1 = "fileToUpload3";
 $photoErr3 = checkSizeType($string1);
 // list($width, $height, $type, $attr) = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
 // printf("width is: %d height is :%d\n", $width, $height);
 //printf("type is : %s.\n", $type);
 //printf("attribute is : %s.\n", $attr);
 //below gets array of info from the file temporarily stored on server
 //*****************problem with photo, size type, reject & error message**
 // Check if $fail is set to true (too big or not jpeg), if not upload the file
 if ($fail == 'true') {
     //should default to form here and display error message for field that failed
 } else {
     //need to move into section below for if $fail = 'false'
     //this is where the file is moved from special area to real file
     $target_dir = "photos/";
     $target_file1 = $target_dir . basename($_FILES["fileToUpload1"]["name"]);
     $target_file2 = $target_dir . basename($_FILES["fileToUpload2"]["name"]);