Forums

Upload and attach

swervin 06 May, 2008
I have read everything I can find here about uploading a file and attaching it to email. I can upload successfully and get no email, or get email and no upload.
I'm running on php 5.2.0, Joomla 1.0.13, Chronoengine 2.3.9 j10

Debug shows filename when upload is successful.

I'm at a loss here and need some straight forward steps to get this working.

I'd be will to pay someone to get it working.

One issue I cannot get resolved is the ISP is running php with register_globals on and safe_mode on. Would these create an issue?

If anyone can help out I'd certainly appreciate it.
GreyHead 07 May, 2008
Hi swervin,

Please take a form backup in the form manager and post it here.

Bob
swervin 07 May, 2008
Here it is.. And thank you for taking a look!
swervin 07 May, 2008
Sorry.. System would accept non-compressed upload.. Here goes [file name=Careers.zip size=1311]http://www.chronoengine.com/images/fbfiles/files/Careers.zip[/file]
GreyHead 07 May, 2008
Hi swervin,

I have it working OK so far.

Please try this:

1) set the 'format' to 'my template' in th General tab

if this works then

2) Remove all mentions of the form field from the email template and try with the template format.

if (1) doesn't work then please set Error Reporting to Maximum in the site General Config and see what messages show up.

Bob
swervin 07 May, 2008
Okay.. It is now uploading, using email template without reference to upload field. It is not however, sending email.
I'm attaching screenshot of debug output after submission.
Setting the debug level under general tab is either On or Off, not provisions I see for setting a level of debug.
Also sending the backup of form after modifications. [file name=Careers-7091cb6747667bbcb5fdffa9f059f20a.zip size=1190]http://www.chronoengine.com/images/fbfiles/files/Careers-7091cb6747667bbcb5fdffa9f059f20a.zip[/file]
swervin 07 May, 2008
sending screen cap as zipped att. [file name=cf_debug_capture.zip size=7454]http://www.chronoengine.com/images/fbfiles/files/cf_debug_capture.zip[/file]
swervin 13 May, 2008
Remove all references to field names in template. File uplaods but email is not sent.

_POST: Array ( [job_interest] => 1 [name] => irve [email] => [email]irvet@newtarget.com[/email] [submit] => Submit )
Case 2: Use template
E-mail: 'Yes' custom
Email not sent
E-mail message

From: Fair Labor [info@fairlabor.org]
To: [email]irvet@newtarget.com[/email]
Subject: Fair Labor Inquiry
Testing


Any ideas of thing I should look at?
swervin 13 May, 2008
If I remove the "enctype=multipart-data" tag, it sends email but does not attach nor upload.

_POST: Array ( [job_interest] => 1 [name] => Irve [email] => [email]irvet@newtarget.com[/email] [resume_doc] => aaaa.pdf [submit] => Submit )
Case 2: Use template
E-mail: 'Yes' custom
Email sent
E-mail message

From: Fair Labor [info@fairlabor.org]
To: [email]irvet@newtarget.com[/email]
Subject: Fair Labor Inquiry
Testing
GreyHead 13 May, 2008
Hi swervin,

If the form is on-line and it's OK with you I'll take a look - please email me login info to the address in my sig.

Bob
swervin 13 May, 2008
Sent info to info.. Thanks!
deonya 13 May, 2008
I am running the sam setting the newest version of joomla and chrono and I am having the same problem
Max_admin 14 May, 2008
Hi deonya, J1.0 or J1.5 you have ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Max_admin 15 May, 2008
Hi deonya,

So if the email is not sent, can you see the file uploaded in the upload folder ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
deonya 15 May, 2008
Correct if the email is not sent the file is in the upload folder and if the email is sent there's no file attached or file in the upload folder.
Max_admin 17 May, 2008
Hi deonya,

Sorry for the delay, please attach your chronocontact.php file here, its under components/com_chronocontact I will test this here

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
deonya 17 May, 2008
No problem I am attaching the file [file name=chronocontact-44483d5b711011144f087e8a8f4d85bf.zip size=5248]http://www.chronoengine.com/images/fbfiles/files/chronocontact-44483d5b711011144f087e8a8f4d85bf.zip[/file]
deonya 20 May, 2008
Were you able to figure out anything
swervin 20 May, 2008
Were you or admin able to determine anything? I can give you ftp to the site if that would help. It's a development site until this issue gets ironed out.
Max_admin 23 May, 2008
Hello,
sorry I'm alittle sick, you have the old code version of the upload function :

function handle_uploaded_files($uploadedfile, $filename, $limits = TRUE, $directory = FALSE)
{
    //global $mosConfig_absolute_path, $mosConfig_fileperms;
	$fileperms = "0644";
    if ( strlen($mosConfig_fileperms) > 0 ) {
        $fileperms = octdec($mosConfig_fileperms);
    }
    $uploaded_files = "";
    $upload_path = JPATH_SITE.'/components/com_chronocontact/upload/';
    if ( is_file($uploadedfile) ) {
        $targetfile = $upload_path.$filename;
        while ( file_exists($targetfile) ) {
            $targetfile = $upload_path.rand(1,1000).'_'.$filename;
        }
        move_uploaded_file($uploadedfile, $targetfile);
        if ( strlen($fileperms) > 0 ) {
            chmod($targetfile, $fileperms);
        }
        $uploaded_files = $targetfile;
    }
    return $uploaded_files;
}


replace it with this :

function handle_uploaded_files($uploadedfile, $filename, $limits = TRUE, $directory = FALSE)
{
    //global $mosConfig_absolute_path, $mosConfig_fileperms;
	//$fileperms = "0644";
    /*if ( strlen($mosConfig_fileperms) > 0 ) {
        $fileperms = octdec($mosConfig_fileperms);
    }*/
    $uploaded_files = "";
    $upload_path = JPATH_SITE.'/components/com_chronocontact/upload/';
    if ( is_file($uploadedfile) ) {
        $targetfile = $upload_path.$filename;
        while ( file_exists($targetfile) ) {
            $targetfile = $upload_path.rand(1,1000).'_'.$filename;
        }
        move_uploaded_file($uploadedfile, $targetfile);
        //if ( strlen($fileperms) > 0 ) {
        //    chmod($targetfile, $fileperms);
        //}
        $uploaded_files = $targetfile;
    }
    return $uploaded_files;
}


cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
deonya 23 May, 2008
thanks allot that fixed the problem.
swervin 31 May, 2008
Any suggestion on my issue?
GreyHead 31 May, 2008
Hi swervin,

Sorry it got buried in the other conversation. Back on my to-do list.

Bob
swervin 12 Jun, 2008
If I want to just link to the uploaded file, rather than attach it to the email, what would the link look like. I've tried several PHP vars relating to the uploaded file and only get pieces of the filename. By creating a link back to the file in the email, the client can simply download it. This would be a good workaround for now.

Thanks
Swervin
This topic is locked and no more replies can be posted.