Forums

For ALL the people with file upload problems !

JohnieWalker 31 Jan, 2008
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
handle_uploaded_files
in that function there is a var
$fileperms = "0000";
and then theres is an if statement
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
$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
$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
$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
GreyHead 31 Jan, 2008
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
highrockmedia 02 Feb, 2008
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
GreyHead 02 Feb, 2008
Hi brewster,

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

Bob
raevana 07 Feb, 2008
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
GreyHead 07 Feb, 2008
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
raevana 08 Feb, 2008
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 08 Feb, 2008
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
Vermillion 31 Mar, 2008
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
Max_admin 31 Mar, 2008
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
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Vermillion 01 Apr, 2008
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.
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
Actor 04 Apr, 2008

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

	$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
Max_admin 04 Apr, 2008
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
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
redrings 11 May, 2008
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:
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 11 May, 2008
Thanks! I was missing the Form Tag Attachment.

One thing though - I would like for the images to show up in the email instead of just attachments. I have tried using the following in my custom email:

<img src="<mysite>/components/com_chronocontact/upload{image1}"></img>

However, it appears that this passes in the original image name instead of the name of the image after the date is appended to it. Is there a {keyword} I can use in the custom email to get the name of the uploaded image?

Thanks!
GreyHead 12 May, 2008
Hi redrings,

Try this snippet (replacing field_name with the name of your upload field):
<?php
global $mosConfig_live_site;
$file = basename($attachments['field_name']);
$upload_path = $mosConfig_live_site.'/components/com_chronocontact/upload/';
?>
<img src="<?php echo $upload_path.$file; ?>"></img>
Bob

Later: added the 'global' line to fix the problem reported in the next post.
redrings 13 May, 2008
Thanks GreyHead! This worked perfectly, except I had to replace $mosConfig_live_site. with my actual site name. For some reason the variable doesn't seem to pass to the email (I was getting this in the email source: <img src="/components/com_chronocontact/upload/20080513184023_Creek.jpg" alt="test" _base_href="JURI::base()/">)

Anyway - thanks! You're the best!
smetal 14 May, 2008
I'm having some issues uploading and I have tried everything that the FAQ and this thread has told me. I've changed the file permissions, added the form tag, and done everything else that I've read. I'm also using Joomla 1.5 and am using version 2.5 J1.5 RC1 of chronocontact. Here is the error that I'm getting:

I echoed out my file permissions.

File perms= 0777

Warning: move_uploaded_file(/home/.../public_html/components/com_chronocontact/upload/20080513222202_Zorro.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/.../public_html/components/com_chronocontact/chronocontact.php on line 538

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phprIRRN5' to '/home/.../public_html/components/com_chronocontact/upload/20080513222202_Zorro.jpg' in /home/.../public_html/components/com_chronocontact/chronocontact.php on line 538

Warning: chmod() [function.chmod]: No such file or directory in /home/.../public_html/components/com_chronocontact/chronocontact.php on line 540
smetal 14 May, 2008
I was actually able to get passed the permission denied issue by changing the permissions on the upload directory itself. Although, I had to change it to 0777 in order to prevent the code from erroring out. However, when I submit the form it is still not uploading the files to that upload destination, nor is it writing the filename in the database anymore. Please help me.

Here is what I get when i turn the debug message on:

_POST: Array ( [creation_user_id] => 66 [status] => A [cat] => Home Decor [title] => cvnb [summary] => cvbn [description] => cvbn [cost] => [time] => )

I will send whomever a backup of the form to an email if need be.
GreyHead 14 May, 2008
Hi smetal,

The debug doesn't help here as it doesn't include the $_FILES array.

I think there was a small fix in a recent ChronoForms release so please update to the latest version.

You can also send a Form Backup to the address in my sig but this will only confirm if there is a problem with the form - permission problems are site / server related.

Bob
smetal 14 May, 2008
Bob,
Thanks a lot for your quick response and help. The update seemed to do the trick. I can now see the files uploaded on the server. The issue that I see now is that when I go to view the form data in the admin I'm not seeing the file name displayed. I'm trying to get into the database now to see if it was inserted in the table, but I think the server is down. Is there some kind of display limit when viewing the form data? The filename is kinda long, because it gets generated.
GreyHead 14 May, 2008
Hi smetal,

There shouldn't be any problem viewing the form data (if the MySQL server is down then your site won't work at all).

Please will you copy and post the code from your form Autogenerated code tab here to check that the file is included there.

Bob

PS I sometimes find that the free EasySQL Joomla Extension is a simple way to look at database tables.
smetal 14 May, 2008
Bob,

Here is the auto-generated code. The "photofile" is the name in the form. It was working before, now it stopped once I upgraded.

<?php 
	$database =& JFactory::getDBO();
	
$database->setQuery( "INSERT INTO #__chronoforms_3 VALUES  (
'' , '". date('Y-m-d')." - ".date("H:i:s")."', '".$_SERVER['REMOTE_ADDR']."' , '".$_POST['cat']."' , '".$_POST['title']."' , '".$_POST['summary']."' , '".$_POST['description']."' , '".$_POST['cost']."' , '".$_POST['time']."' , '".$_POST['photofile']."', '".$_POST['creation_user_id']."' , '".$_POST['status']."');" );
if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>
";
}
?>
GreyHead 17 May, 2008
Hi smetal,

Sorry, I missed this post. Try replacing
$_POST['photofile']
with
$_FILES[$allowed_s2[0]]['name']
Bob
cox 17 May, 2008
hi to all

all made as written http://www.chronoengine.com/component/option,com_easyfaq/task,view/id,29/Itemid,38/

Everything works fine,
mail message comes with an attachment

I have a question:

I put enctype='multipart/form-data' in the Form tag attachment field on the General tab.

How to add verification of javascript onSubmit="return competition(this)" ??? [file name=competition.cfbak size=5540]http://www.chronoengine.com/images/fbfiles/files/competition.cfbak[/file]
GreyHead 17 May, 2008
Hi cox,

Just add it in the same box with a space between the two. Whatever goes in there is added into the <form> tag.

Bob

PS Or you could use ChronoForms validation instead of your own JavaScript, it will work just as well.
cox 17 May, 2008
Thanks GreyHead

everything worked perfectly

sorry OFFTOP
Where can I find how to set ChronoForms validation in the FAQ? or manual
GreyHead 17 May, 2008
Hi cox,

In the Forms Manager, click the Validation tab. Set Validation to ON, select the Mootools library of you have Joomla 1.5 (or are using other Mootools based extensions) put a comma separated list of fieldnames in the 'required' box and save the form.

Most of the validation options are self-evident, there are some wrinkles using validate-one-required though.

Bob
smetal 19 May, 2008
Bob,

First of all, I'd like to thank you for helping me out. I tried changing the autogenerated code to what you said, but now it won't write anything in the database.

I have also started to modify the chronocontact.php file itself. I am trying to generate thumbnails for the images that are uploaded. Then store the original image and thumbnail in a user directory on the server. Then write each uploaded file to the database table. I was trying to just add that code in the onSubmit section, but it wasn't recognizing anything, so that's when I started to play around in the chronocontacts.php file. I have been able to generate the thumbnail, but have not been able to write anything to the database. Perhaps I need to just write a separate SQL query to write to the database after the initial auto generated code is executed. My problem is, that I don't really know the flow of how chronoforms works. I also don't want to be reinventing the wheel or anything, so if there is already some way to auto generate thumbnails and store in the database then I'm all for it, but none that I have found. Any ideas, suggestions?
GreyHead 19 May, 2008
Hi smetal,

There is nothing in ChronoForms to generate thumbnails - or to do anything with images, or to store them in the database. I'm sure all those things are possible though.

You should not need to hack the ChronoForms code to do so though - almost everything is possible using the code boxes.

The flow is pretty simple. The form html and JavaScript are show n when the form is displayed. When the form is submitted the default sequence is:[list]
  • Check the Anti-Spam
  • Check the uploaded files and move them to the uploads folder
  • Run the OnSumbit before code
  • Send the email if requested
  • [/list][list]Run the Onsubmit after code
  • Run the AutoGenerated Code
  • Redirest if requested
  • [/list]The Plugins live in the sequence and there are some user options around the sequence at the end but that's basically it.

    I tend to put custom code to do with the email in the OnSubmit before box and anything else in the OnSubmit after. The boxes are called through eval and you may need to declare any global variables you want to use.

    Bob
    smetal 19 May, 2008
    Bob, thanks for the quick reply. I was hacking the chronocontact.php file, because I need to modify the way the files are uploaded. I need to upload both the original and thumbnail to a dynamically generated folder. Based on your sequence, the "check uploaded files and move them to the uploads folder" is before the OnSubmit before code. So, wouldn't I need to hack the file, or some how change the default sequence? Regardless, I have been able to get it to work the way I want it to, with the exception of writing to the database. I've made changes in the auto generated SQL and now nothing is being written to the database. This would be the only thing that I would need help on.
    smetal 19 May, 2008
    Bob,

    I have reverted to my original auto-generated code which I have posted below, however nothing is getting written to the database at all anymore. Before Everything except the photofile was getting written, now nothing is.

    <?php 
    	$database =& JFactory::getDBO();
    	
    $database->setQuery( "INSERT INTO #__chronoforms_3 VALUES  ( 
    '' , '". date('Y-m-d')." - ".date("H:i:s")."', '".$_SERVER['REMOTE_ADDR']."' , '".$_POST['cat']."' , '".$_POST['title']."' , '".$_POST['summary']."' , '".$_POST['description']."' , '".$_POST['cost']."' , '".$_POST['time']."' , '".$_POST['photofile']."', '".$_POST['creation_user_id']."' , '".$_POST['status']."');" ); 
    if (!$database->query()) { 
    echo " alert('".$database->getErrorMsg()."'); window.history.go(-1);  
    "; 
    } 
    ?>
    GreyHead 19 May, 2008
    Hi smetal,

    I would have probably let ChronoForms upload the files and then moved them on to the dynamic folder, either will work but hacking the code always makes upgrading more difficult.

    I'd echo out the sql and test it in PHPMyAdmin. What is there looks OK to me. Is the table name still correct?

    Bob
    smetal 20 May, 2008
    Bob, I have not made any table name changes, but I reverted back to the original "hack free" chronocontact.php file and still nothing is being written to the database table. I have tried to echo out the SQL, but nothing ever shows. Is there some light weight debugging tool out there that you use? Or, am I putting the echo in the wrong place? I put it in the code where it says "execute Query if any"
    GreyHead 20 May, 2008
    Hi smetal,

    To get the sql you have to make a small change to Max's default code.
    $sql = "INSERT INTO #__chronoforms_3 VALUES  (  
    '' , '". date('Y-m-d')." - ".date("H:i:s")."', '".$_SERVER['REMOTE_ADDR']."' , '".$_POST['cat']."' , '".$_POST['title']."' , '".$_POST['summary']."' , '".$_POST['description']."' , '".$_POST['cost']."' , '".$_POST['time']."' , '".$_POST['photofile']."', '".$_POST['creation_user_id']."' , '".$_POST['status']."');";
    if  ( $debug ) {
      echo "sql: $sql <br />;
    }
    
    setQuery( $sql );  
    if (!$database->query()) {  
    echo " alert('".$database->getErrorMsg()."'); window.history.go(-1);   
    ";  
    }  
    ?>
    this just pulls the sql into a separate variable and show sit in DeBug mode. You should then be able to copy and paste it into PHPMyAdmin and see if it runs or not. You will need to manually change the table prefix, probably from #__ to jos_

    Bob
    smetal 20 May, 2008
    Bob,

    I tried what you said, turned on the Debug mode in the Chronoforms component under the General tab. Nothing is getting echoed out. The DEBUG option under the General tab says that I'm supposed to see some kind of diagnostic output, but I don't see anything. I tried turning the system debug on in the Global Configuration settings and I received an error when trying to go to my form page. It said the jos_chrono_contact_plugins table does not exist. I did not delete this table, so was it just never created? Why does the form show up when the system debug is off, but produce an error when it is on?
    GreyHead 20 May, 2008
    Hi smetal,

    If the debug info doesn't show then you probably have a Redirect URL in the Form URLs tab, please remove it temporarily.

    Sorry, but I've no idea about the site debug results. If you want an easy way of looking at the MySQL tables then I recommend EasySQL, a very neat little table browser extension for Joomla.

    Bob
    smetal 20 May, 2008
    Bob,

    Thanks for the quick reply. Yes, I did have a redirect URL, thanks for the hint. I actually have been using the EasySQL you recommended to me earlier, pretty neat. I submitted my form and I found out why nothing was getting written to the table. The auto generated code is not even being executed. This is the error that I am receiving
    "Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in .../components/com_chronocontact/chronocontact.php(571) : eval()'d code on line 14"

    Here is that block of code, which I did not touch. It looks like there is nothing wrong with it either.
    /**
    			 * Run the SQL query if there is one
    			 */
    			if($paramsvalues->autogenerated_order == $ixx){
    				if ( !empty($rows[0]->autogenerated) ) {
    					eval( "?>".$rows[0]->autogenerated );
    				}
    			}
    GreyHead 20 May, 2008
    Hi smetal,

    The problem is in the eval()'d code - in this case it's the code in the AutoGenerated tab of your form - check line 14 there : most likely a missing ;

    Bob
    smetal 20 May, 2008
    Bob,

    Thanks a ton for all of your help. This has been a real learning experience for me and I thank you for that. My project is almost complete, but I seem to be having one more issue. Nothing gets written to the database when I have the redirect URL set. It's not any special kind of url or anything, just a URL to an article. If I take off the redirect everything works perfectly, but it's just an empty white box if I do that. Do you know what could be causing this? Thanks in advance.
    GreyHead 20 May, 2008
    Hi smetal,

    Thanks.

    There's something odd happening with that Redirect. A couple of people have mentioned it but I can't see anything wrong, and Max hasn't suggested anything either.

    Please will you take a Backup Copy of your form from the Forms Manager and a copy of your chronocontact.php file and email both of them to me at the address in my sig and I'll take a look.

    Bob
    smetal 21 May, 2008
    Bob,

    I sent the stuff over to your email yesterday. Just wondering if you had a chance to take a look at it yet.
    GreyHead 21 May, 2008
    Hi smetal,

    All safely received, next on the list to look at. Back shortly.

    Bob
    GreyHead 21 May, 2008
    Hi smetal,

    Confirming that you have a buggy version of chronocontact.php please download the fixed version from this post

    . . . now to find out where you got it from, the downloads were fixed a while back, or so I thought.

    Bob
    smetal 21 May, 2008
    Bob,

    Thanks so much! That fixed it. I downloaded the upgrade package. Again, thanks a bunch for all of your patience and help, you are awesome! :cheer:
    rlance 03 Jun, 2008
    The octdec function must be applied to the '0644' before actually using it to set the file permissions. Like $fileperms = octdec('0644');

    The original code did this after picking up the value from $mosConfig_fileperms.

    However, even after making sure the decimal-to-octal conversion was taking place, and the proper permissions were showing up in the uploaded file, I am still not getting the file posting to its column in the database table jos_chronoforms_x.

    Can someone point me to the code that does the insert to this table? I am so far unable to find it in chronocontact.php, or anywhere.
    smetal 03 Jun, 2008
    It's in the auto-generated code section in the chronoform backend.
    randy270 14 Jul, 2008

    Hi redrings,

    Have you checked this FAQ??

    Bob



    Hi Bob,

    Big problem with this FAQ.

    Check in your configuration.php file that there is a value set for $mosconfig_fileperms; if it is blank or set to '0000' please set it to 0644.



    The only configuration.php file I have in my directory is the main one for Joomla itself. It does not list $mosconfig_fileperms; anywhere within it.

    Check that "chmod new files" is ticked in Joomla's Global Configuration.



    I don't see this anywhere in the Joomla control panel. Am I not looking in the right place?

    Otherwise, what is happening is that the server is telling me my .jpg file type is not allowed. Where do I change something to allow that setting?

    Otherwise, the form is installed and looks great.
    Max_admin 14 Jul, 2008
    Hi, remove the chmod line from the upload function!

    Cheers

    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    randy270 21 Jul, 2008

    Hi, remove the chmod line from the upload function!

    Cheers

    Max



    Max,

    Thanks for the tip, but could you be more specific? Are you talking about the function within the configuration.php file?

    If so, the only place that has anything about chmod was commented out.

    Here's what I now have:

    function handle_uploaded_files($uploadedfile, $filename, $limits = TRUE, $directory = TRUE)
    {
    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;
    }


    So far, I've removed the quotes from around 0644. I've uncommented the chmod line. I don't want to email a file. I want a user to upload it to a directory.

    I have the form installed, and when I click submit, I do get a confirmation email, but no file is transferred.

    Is there some other setting I need to change?

    And I've read the faq, and I've made sure I've followed the suggestions.

    Randy
    Max_admin 21 Jul, 2008
    Hi Randy, try to comment this line :

    chmod($targetfile, $fileperms);

    what are the results ?

    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    randy270 21 Jul, 2008
    When I set the code thusly:
    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;
    }
    I get to the blank site page fine, but nothing appears in the upload directory. No other obvious errors reported.
    GreyHead 22 Jul, 2008
    Hi randy270,

    I think you'll need to add some debug code to show what's happeining here. Just echo some of the variables back to map the progress of the function.

    Bob
    Max_admin 24 Jul, 2008
    Hi Randy,

    to clear Bob's words, just add some statements like :

    echo '1';

    between lines, so you know that all is going fine by counting the output later, did you check the folders permissions ?
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    socialite7 18 Nov, 2009
    Can someone please help... I thumbed through all of these forums and figured out how to add fields to the database and get them to record my data, but I cannot click on my upload field, because it just stores it as text. Is there a way to make it viewable or downloadable?
    GreyHead 18 Nov, 2009
    Hi socialite7,

    What kind of files are you uploading and what do you want to do with them?

    You can make the file downloadable by creating a link using the file upload path and the file name.

    Bob
    khalid2010 03 Dec, 2009
    Hi GreyHead,

    I have the same problem of socialite7. The visitors uploads a "pdf" files but when viewing them from the control panel I get the uploaded file as the name of the file but without a link. I want to be able to click on it and download the "pdf" file.
    Max_admin 05 Dec, 2009
    Hi Khalid2010,

    This will require a core file hack, its posted in the forums before!

    Regards,
    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    khalid2010 06 Dec, 2009
    Thanks admin.

    I did the hack myself and worked fine.
    This topic is locked and no more replies can be posted.