Hi, I was wondering if anyone could help me with this.
I wanted to create a new image field type. This is to actually display an image within the form. The use is for a recruitment module - I want to be able to view a photo of each candidate along with the rest of the details.
I found this post:
http://www.sugarcrm.com/forums/showt...t=26723&page=2
which was helpful.
I used the code suggested and uploaded the new field type folder 'photo' into include/sugarfields/fields/
I then changed the field type in editviewdefs.php and detailviewdefs.php
I also had to remove a couple of lines from my htaccess file so it displayed correctly.
The problem I have it the image file doesn't actually upload. I can browse for it and select, it stores the filename value, but doesn't upload.
If I manually FTP the image afterwards it displayed fine.
I thought maybe it might be a permissions problem, but I have now set the folders to 777
This is the code from upload.php
Any suggestions would be greatly appreciated. Thank youCode:<?php $target_path = 'phpThumb/images/' . basename( $_FILES["file"]["name"]); if (($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") && ($_FILES["file"]["size"] < 20000)){ if ($_FILES["file"]["error"] > 0){ echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; }else{ if (file_exists("phpThumb/images/" . $_FILES["file"]["name"])){ echo '<br />' . $_FILES["file"]["name"] . ' already exists.'; }else if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)){ chmod($target_path, 0644); echo '<img src="phpThumb/phpThumb.php?src=images/' . $_FILES["file"]["name"] . '&h=80&w=80">'; } } } ?>


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks