php move_uploaded_file - is this a .htaccess issue?

Permalink
I'm not sure if this is a Concrete5.7 issue or a newbie php question but I'm really stuck and this is the last thing I need to fix to finish up a long overdue code job.

I have a site working in Concrete5.6.3.3 that uses the php_move_uploaded_file to take image files from php forms and place them in a specific directory. This php renames, uploads them to a folder called /files/uploads them and sends info from the form to a MySQL dbase. We are then zipping the files up and transferring them to devices. So this isn't using the standard Concrete5 upload folder.

I transferred the site over to a new bitnami server with Concrete5.7 and have overcome most of the changes. The last one is figuring out how to manage to upload those files with the new path info. There are two issues or maybe 3.

1. What is the base path? I lucked out on the 5.6 version of the error logs and was able to figure out the correct path after lots of trial and error. On the new server, I put the files in a subdirectory called /files/uploads with 777 permissions I'm able to access them to show in the webpages but I can't upload.

Here is the code from each of the sites
OLD SERVER
 //     move_uploaded_file($_FILES["file"]["tmp_name"], "/home/myoldsite/public_html/mysitedirectory/dir/files/uploads/" . $createdfilename);
NEW SERVER
// sg This probably will require the full path info that I don't yet have
           move_uploaded_file($_FILES["file"]["tmp_name"], "/opt/bitnami/apps/concrete5/htdocs/files/uploads/" . $createdfilename);


I know that I probably have a basic misunderstanding of the difference between the htdocs and public_html directory paths so I'm really confused. The updated file name is actually getting to the dbase so I know the only problem is with my directory or maybe something I need to do with httpaccess or the php.ini but I don't know what that is.

2. I did find a reference in some earlier concrete5 forums that suggested that I make a file and put it in my site root that says this;

php5.ini This is the filename
file_uploads = On
upload_max_filesize = 32M
post_max_size = 32M
upload_tmp_dir = /tmp/

I checked php_info and these are set to php 4.xxx in the php.ini that is set up for the install
file_uploads = On
upload_max_filesize = 40M
post_max_size = 40M
upload_tmp_dir = /opt/bitnami/php/tmp

3. I found some information on the bitnami docs about file permissions in .htaccess but I'm not exactly sure how to edit .htaccess and whether this is the right things to do.

Do I just add these lines?
<Directory "/opt/bitnami/apps/concrete5/htdocs/files/uploads/>
  Allow from all
</Directory>
<Directory "/opt/bitnami/apps/concrete5/htdocs/files/data/>
  Allow from all
</Directory>


Any help would be appreciated.

 
spiraljetty replied on at Permalink Reply
Fixed!
Here is the link to the documentation that explains file uploads in bitnami.
https://wiki.bitnami.com/BitNami_Cloud_Hosting/Servers/Access_your_m...
We were able to resolve this by running some sudo commands on the server.
$ sudo chown -R bitnami:daemon /opt/bitnami/apps/concrete5/htdocs/files/uploads
$ sudo chmod -R g+w /opt/bitnami/apps/concrete5/htdocs/files/uploads

I got some support from the bitnami community and the answer is listed here;
https://community.bitnami.com/t/htaccess-for-php-file-uploads-concre...
regarding the difference in the file paths. It's unix vs apache. Duh.