Change "tmp" dir for uploading file - PHP / Upload / Editor
Change "tmp" dir for uploading file - PHP / Upload / Editor
Hi All,
I'm trying to upload an image using the Editor PHP library.
Following the manuals, I have got it down pretty well (Allan you are a legend!!)
When uploading, traditionally, the file is stored in the temp folder before it's moved to the actual folder/database.
My only issue now is, my back-end guys have removed all permissions for the "tmp" folder on the server.
So when I try to create/edit (haven't tried remove) the image using Editor - I get this error:
"A server error occurred while uploading the file".
Checking the response in the inspector, this is printed out: (I took out my server root)
Warning: move_uploaded_file(..../uploads/lts.png): failed to open stream: Permission denied in /..../dist/lib/Editor/Upload.php on line 488
Warning: move_uploaded_file(): Unable to move '/tmp/phpXDWwY4' to '..../uploads/lts.png' in /***/dist/lib/Editor/Upload.php on line 488
Is there a way to change the temp folder directory in the Upload
instance? Perhaps somewhere here:
->upload(
Upload::inst( $_SERVER['DOCUMENT_ROOT'].'/uploads/__NAME__' )
Answers
What a nice way to start the weekend - thank you .
Are you sure that it is the /tmp dir that they've revoked access to (which would be a really odd thing to do imho) and not the destination directory?
..../
is a somewhat odd directory path start - it might well be related to that rather than /tmp permissions.Try using an absolute path instead:
I'd be interested to know what:
returns...
Allan
Thanks for your reply Allan, I changed to the absolute path but got the same error back.
Yip, they have restricted access on majority of the server....Making my job a lot harder
Sorry I just used this in place of the actual path
Doing the var_dump returns:
string(34) "/var/www/html/the_main_directory"
(I've just changed the name of the directory)It seems the 'tmp' folder is not located in the above directory. I saw it is located somewhere here:
/var/www/html/tmp
instead. I created a tmp dir now here:/var/www/html/the_main_directory/tmp
. Could I change the tmp folder path to this in Editor? (I don't have access to the php.ini file)