[Vtigercrm-commits] [vtiger development] #4439: Image Upload Detection Failure
vtiger development
vtiger-tickets at trac.vtiger.com
Mon Nov 12 08:10:28 EST 2007
#4439: Image Upload Detection Failure
------------------------+---------------------------------------------------
Reporter: prasad | Owner: developer
Type: defect | Status: new
Priority: critical | Milestone: 5.0.4
Component: vtigercrm | Version: 5.0.3
Resolution: | Keywords:
------------------------+---------------------------------------------------
Comment (by prasad):
The problem is due to image type detection on the javascript, the filename
is split on "." but my folder has several "." (dots).
See the code fix below: [ file include/js/general.js ]
{{{
function getFileNameOnly(filename) {
var onlyfilename = filename;
// Normalize the path (to make sure we use the same path separator)
var filename_normalized = filename.replace(/\\/g, '/');
if(filename_normalized.lastIndexOf("/") != -1) {
onlyfilename =
filename_normalized.substring(filename_normalized.lastIndexOf("/") + 1);
}
return onlyfilename;
}
function formValidate() {
//Validation for Portal User
if(gVTModule == 'Contacts' && gValidationCall != 'tabchange')
{
if(getObj('portal').checked && trim(getObj('email').value) == '') {
alert(alert_arr.PORTAL_PROVIDE_EMAILID);
return false;
}
}
if(gVTModule == 'Contacts')
{
if(getObj('imagename').value != '' )
{
var image_arr = new Array();
// Fix added for image type detection based on filename
var onlyfilename = getFileNameOnly(getObj('imagename').value);
// Filename can be like 'myimage.jpg' or 'myname.nov.png' or 'README'
etc...
if(onlyfilename.indexOf(".") != -1) {
var namearray = onlyfilename.split(".");
image_arr = new Array(namearray.slice(0,
namearray.length-1).join("."), namearray[namearray.length-1])
}
if((image_arr[1] == "jpeg") || (image_arr[1] == "png") || ...
}}}
--
Ticket URL: <http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/4439#comment:1>
vtiger development <http://trac.vtiger.com/>
vtigerCRM
More information about the vtigercrm-commits
mailing list