My problem is that everytime when a user uploads photos through my app in openshift it gets lost.When i try to update the code through git,I couldn't find a solution on the net.So I came here for experts advice. i would also appreciate if anyone can point me to an article that does it for php app in openshift.
The problem is simple my user uploaded files are stored in /user/{$_SESSION['id']}
folder that is located in repo folder. through research i found that it should be stored in app-root/data
folder. If so how can i store user uploaded photos directly there and access it for the user who wants to view it in browser directly like www.testing-pad4u.rhcloud.com/home.php?u={$_SESSION['name']}
.
i have no clue on how to do it please help me or point me in the right direction as i'm a total noob to Linux.
after some troubleshooting steps as told in this site https://yuan3y.com/2014/10/setting-up-an-upload-folder-in-openshift/
i modified the code for my own purposes and here is the code:
`#!/bin/bash
# This deploy hook gets executed after dependencies are resolved and the
# build hook has been run but before the application has been started back
# up again. This script gets executed directly, so it could be python, php,
# ruby, etc.
# This script will create a permanent storage folder on openshift
# put this in .openshift/action_hooks/build
echo ".............pre_build............creating symlinks.................";
if [ ! -d "$OPENSHIFT_DATA_DIR/upload/user" ]; then
mkdir $OPENSHIFT_DATA_DIR/upload/user
echo "directory user made.";
if [ ! -d "$OPENSHIFT_DATA_DIR/upload/group" ]; then
mkdir $OPENSHIFT_DATA_DIR/upload/group
echo "directory group made.";
ln -sf $OPENSHIFT_DATA_DIR/upload/user $OPENSHIFT_REPO_DIR/user
ln -sf $OPENSHIFT_DATA_DIR/upload/group $OPENSHIFT_REPO_DIR/group
echo ".................creating symlinks completed........................";
##source: https://www.openshift.com/forums/openshift/one-newbie-question`
and the error i get is as follows:
line 22: syntax error: unexpected end of file
remote: An error occurred executing 'gear postreceive' (exit code: 2)
remote: Error message: CLIENT_ERROR: Failed to execute action hook 'build'