For ALL the people with file upload problems !

Shows some Tutorials

For ALL the people with file upload problems !

Postby JohnieWalker on Thu Jan 31, 2008 2:07 am

For those who don't wanna read all the text - just scroll down for solution.
A little introducion.
Today I was making a Joomla site for my customer. He requested to add an application from to his site. So, I thought why not to use ChronoForms. Ok downloaded, installed, looked into the manual, did everything. Added a file field, added enctype etc. Trying to submit... Dang, E-mail not sent... OK, I thought... Let's debug this. So I went to chronocontact.php and found a neat little function called
Code: Select all
handle_uploaded_files
in that function there is a var
Code: Select all
$fileperms = "0000";
and then theres is an if statement
Code: Select all
if ( strlen($mosConfig_fileperms) > 0 ) {

        $fileperms = octdec($mosConfig_fileperms);

    }

I though ok ... Let's see our $mosConfig_fileperms var in configuration.php . And dang ! It was
Code: Select all
$mosConfig_fileperms = '';

AHA ! Got you ! Basically because of that var the file was uploaded with 0000 CHMOD, that means that only webserver root can do something with it, that means that mosMail function wasn't even able to read this file, hence the "E-mail not send" error, since I dont have any root .. I changed it to 0644 so it became like this
Code: Select all
$mosConfig_fileperms = '0644';

And voila! "E-mail sent!" I'm happy, customer happy, everyone is happy.

SOLUTION

Short solution for those who don't wanna read all the text. All you need to do, is change $mosConfig_fileperms in your configuration.php to '0644' if it is ''. So it must look like that
Code: Select all
$mosConfig_fileperms = '0644';


P.S Sorry for my English, not a native speaker.<br><br>Post edited by: JohnieWalker, at: 2008/01/30 21:09
JohnieWalker
Fresh Boarder
 
Posts: 1
Joined: Wed Jan 30, 2008 6:49 pm

Re:For ALL the people with file upload problems !

Postby GreyHead on Thu Jan 31, 2008 6:44 pm

Hi JohnieWalker,

Great debug, thank you. I think we can add a check for this into ChronoForms that would write in a default value if the config value is not set.

Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3253
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:For ALL the people with file upload problems !

Postby brewster on Sat Feb 02, 2008 2:08 am

This sounds like the problem I was having here.

Could that also explain why file upload that also sends an email works on some local servers and not remote because of permissions?<br><br>Post edited by: GreyHead, at: 2008/02/01 23:45
brewster
Fresh Boarder
 
Posts: 18
Joined: Mon Jan 14, 2008 3:13 pm

Re:For ALL the people with file upload problems !

Postby GreyHead on Sat Feb 02, 2008 4:46 am

Hi brewster,

Could be, needs a few users to test it out.

Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3253
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:For ALL the people with file upload problems !

Postby raevana on Thu Feb 07, 2008 4:58 am

I thought that this was my problem. The file showed up with 33KB on the website and when I downloaded it was 0 KB.

I followed your instructions, however, when I use 0644 the file is actually flagged as 204 and appends a T at the end of the permissions -w----r-- T. File still 0KB when I download.

I tried changing it to 777 and it flags the file as -wxrw-wt .
File is still 0 KB when I download. I've never seen the t before.

Any ideas?
Thanks in advance for any help you can offer.
Ruth
raevana
Fresh Boarder
 
Posts: 4
Joined: Wed Feb 06, 2008 9:46 pm

Re:For ALL the people with file upload problems !

Postby GreyHead on Thu Feb 07, 2008 5:59 am

Hi Ruth,

Just to be clear - showing up as 33kb on the website - this is in the Uploads folder so the upload has completed successfully?

Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3253
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:For ALL the people with file upload problems !

Postby raevana on Fri Feb 08, 2008 10:00 pm

Hi Bob and thanks for your reply.

Yes, the file shows up as 33KB in the Upload folder.

Now I need to download the file to my local PC for use.
The script was edited to set the permissions to 644. But when I look at the file in FTP, the permissions are shown as -w----r-T.
If I try to download FTP gives the 550 error message: Cannot open, permission denied.

So I went back into the script and changed the rights to 777. Now when I upload a new file it shows up in the Upload folder with -wxrw--wt. If I try to FTP the file to my local PC I still get the 550 error message: Cannot open, permission denied.

How can I download the file for use on my PC? Is it an ownership issue?

Thanks, Ruth
raevana
Fresh Boarder
 
Posts: 4
Joined: Wed Feb 06, 2008 9:46 pm

Re:For ALL the people with file upload problems !

Postby raevana on Fri Feb 08, 2008 10:08 pm

Yes, the file does upload to the "Upload" directory.

I followed the instructions for changing the rights to the file to 644. When the file uploads it now shows the rights as:
-w----r--t or 204

I edited the script to change them to 777. When the file uploads it shows the rights as: -wxrw----t (362).

In both cases, when I try to ftp the file to my local PC I get :

550 Can't open 20080208085806_chronoforms.txt: Permission denied
Error: Download failed

How can I download the file so it can be used locally?

Thanks,
Ruth
raevana
Fresh Boarder
 
Posts: 4
Joined: Wed Feb 06, 2008 9:46 pm

Re:For ALL the people with file upload problems !

Postby Vermillion on Mon Mar 31, 2008 9:40 pm

Can anyone show me a example for a complete upload script?^^

sorry if this question is already asked but i just fly over the thread because read a lot of english text is exertive...

i searched in diffrent other forums and looked for finished scripts with google but i didn't found... hope you can help me
Vermillion
Fresh Boarder
 
Posts: 5
Joined: Thu Mar 20, 2008 9:00 am

Re:For ALL the people with file upload problems !

Postby admin on Mon Mar 31, 2008 10:48 pm

Hi Vermillion,

Add this code to the html box : <input type="file" name="file"> , now follow the uploads section tab guidelines and you can look for some extra details too in the FAQs section here on the site or search the forums for "type="file"" and you will get lots of code results posted by users about this :)

Cheers

Max
ChronoForms/ChronoConnectivity/ChronoComments Developer Thanks for using our components!
If you have any problems with any extension please tell us.
If you like any of our extensions please post a review at Joomla.org
Want users to submit their content to your website ? try Submit Story
Want to list/edit/delete your data ? try ChronoConnectivity
Want to have stylish AJAX comments ? try ChronoComments
User avatar
admin
Platinum Boarder
 
Posts: 2355
Joined: Mon Aug 14, 2006 5:29 am

Re:For ALL the people with file upload problems !

Postby Vermillion on Tue Apr 01, 2008 1:23 pm

thx a lot^^

Now nearly everything works perfectly... the user can choose the file which he'd like to upload and can klick on submit and there is no error message anymore :)

but now there is a problem at the backend...
i get the form with name, description and everything i set. but the file is given with the local path e.g.
Code: Select all
C\\files\\myexample.tar.gz


how can i get the path on the server? or isn't the file uploaded yet?<br><br>Post edited by: Vermillion, at: 2008/04/01 10:08
Vermillion
Fresh Boarder
 
Posts: 5
Joined: Thu Mar 20, 2008 9:00 am

SOLVED:For ALL the people with file upload problem

Postby Actor on Fri Apr 04, 2008 1:46 am

raevana wrote:Hi Bob and thanks for your reply.

Yes, the file shows up as 33KB in the Upload folder.

Now I need to download the file to my local PC for use.
The script was edited to set the permissions to 644. But when I look at the file in FTP, the permissions are shown as -w----r-T.
If I try to download FTP gives the 550 error message: Cannot open, permission denied.

So I went back into the script and changed the rights to 777. Now when I upload a new file it shows up in the Upload folder with -wxrw--wt. If I try to FTP the file to my local PC I still get the 550 error message: Cannot open, permission denied.

How can I download the file for use on my PC? Is it an ownership issue?

Thanks, Ruth


I had exactly the same problem (ChonoForms v2.5 J1.5_RC2.1) and discovered a bug in file "chronocontact.php"

change somewhere line 550

Code: Select all
   $fileperms = "0644";
into
   $fileperms = 0644;


Rationale: $fileperms is used as parameter of function chmod(), and should be an integer, not a string type.

That should solve the issue.<br><br>Post edited by: Actor, at: 2008/04/04 02:42
Actor
Fresh Boarder
 
Posts: 2
Joined: Thu Apr 03, 2008 6:29 pm

Re:SOLVED:For ALL the people with file upload problem

Postby admin on Fri Apr 04, 2008 7:19 pm

Hi Vermillion,

And I guess too that you don't get the file attached at the email ? do you ? did you add the enctype="multipart/form-data" to the form tag attachment field ?

Thanks again Actor ;)

Max
ChronoForms/ChronoConnectivity/ChronoComments Developer Thanks for using our components!
If you have any problems with any extension please tell us.
If you like any of our extensions please post a review at Joomla.org
Want users to submit their content to your website ? try Submit Story
Want to list/edit/delete your data ? try ChronoConnectivity
Want to have stylish AJAX comments ? try ChronoComments
User avatar
admin
Platinum Boarder
 
Posts: 2355
Joined: Mon Aug 14, 2006 5:29 am

Re:For ALL the people with file upload problems !

Postby redrings on Sun May 11, 2008 5:11 pm

Hello,

I am using Joomla 1.5 version of chronoforms and I can't get file uploads to work.

I have checked in the chronoforms.php and the fileperms is commented out:
Code: Select all
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/';
redrings
Fresh Boarder
 
Posts: 3
Joined: Sun May 04, 2008 5:37 pm

Re:For ALL the people with file upload problems !

Postby GreyHead on Sun May 11, 2008 5:30 pm

Hi redrings,

Have you checked this FAQ??

Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3253
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Next

Return to ChronoForms How To

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests