- Stuff
- Wednesday, July 11th, 2007 at 1:34:04pm MDT
- if (isset($_POST['addProductAttributeTypeButton'])){
- $patv->saveNewProductAttributeType($_POST['product_attribute_type'],$_FILES['product_artwork_template']);
- }
- // ********** different file *****************
- function saveNewProductAttributeType($product_attribute_type,$product_attribute_type_artwork_template){
- include_once("classes/ProductAttributeType.class.php");
- if (!strlen($product_attribute_type['name'])>0) $errors[] = 'Product name not set';
- if (isset($product_attribute_type['is_artwork'])){
- if (!strlen($product_attribute_type['width'])>0) $errors[] = 'Product width not set';
- if (!strlen($product_attribute_type['height'])>0) $errors[] = 'Product height not set';
- if (!strlen($product_attribute_type['dpi'])>0) $errors[] = 'Product dpi not set';
- if (!isset($product_attribute_type_artwork_template)) $errors[] = 'Artwork template file not uploaded.';
- else {
- try{
- fileUploadErrorCheck($product_attribute_type_artwork_template);
- }
- catch (Exception $e){
- $errors[] = $e->getMessage();
- }
- }
- }
- // ........... other code .............
- }
- function fileUploadErrorCheck($file){
- switch ($file['error']) {
- case UPLOAD_ERR_OK:
- break;
- case UPLOAD_ERR_INI_SIZE:
- echo "bugger ini size";
- throw new Exception("The uploaded file exceeds the upload_max_filesize directive (".ini_get("upload_max_filesize").") in php.ini.");
- break;
- case UPLOAD_ERR_FORM_SIZE:
- echo "max file size";
- throw new Exception("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.");
- break;
- case UPLOAD_ERR_PARTIAL:
- throw new Exception("The uploaded file was only partially uploaded.");
- break;
- case UPLOAD_ERR_NO_FILE:
- throw new Exception("No file was uploaded.");
- break;
- case UPLOAD_ERR_NO_TMP_DIR:
- throw new Exception("Missing a temporary folder.");
- break;
- case UPLOAD_ERR_CANT_WRITE:
- throw new Exception("Failed to write file to disk");
- break;
- default:
- throw new Exception("Unknown File Error");
- }
- }
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.