FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Curl chmod file transfer problem...
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Curl chmod file transfer problem... [message #179370 is a reply to message #179369] Sat, 13 October 2012 14:25 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 10/13/2012 2:42 AM, sathyashrayan wrote:
> Group,
> I am facing a problem with curl file transfer. I have one form in
> a site A. The form collects some data and also a file (file upload).
> When that form gets submitted it stores the data in the site A and
> also stores the data in site B( another server ). The data are
> getting saved from server A to server B. But the file transfer
> with curl has file permission problem. My file need to have
> 0777 chmod for the curl to read and transfer.
>
> What I do is I read the file with
>
> chunk_split(base64_encode(file_get_contents($file)));
>
> from site A and transfer that data to site B (another server). If
> i change the permission in site A's file that needed to be read,
> through shell as a root, chmod 777, and make a curl transfer then
> it is getting stored perfectly in server B. But when i make a file
> transfer through a code then i could not use chmod function because
> the file is stored as a "apache" in user but not as a "root".
>

That is correct. A user file should NEVER be stored as the root user.
But why are you setting the execute bit on a non-executable file?

> Detailed explanation:
> ---------------------
> I have a joomla site with a enquiry form in chronoform. I have some
> text and also one file upload in the chrnoform. When a user asks
> for a quote, those data need to stored in a sugerCRM (sugarCRM
> leads module, web to leads form, campaign). Joomla site is in
> server A and sugarCRM is in server B. The uploaded file will be
> stored in the notes table (mysql) of sugarCRM. All worked if i
> manually change the file to chmode 777. But i want it happen
> when some one upload the file in the chronoform. I tried chmod
> through a php code but it does not work because the program
> that creates the file will have "apache" as a user not as
> "root" user. Any workaround? I just need to know if changing
> the file permission from 0644 to 0777 through program. Any
> help? If anyone wants i could pastebin the code and post it here.
>

You can't chmod the file unless you are the owner or the root user.

The question is why you can't read the file in PHP. With 644
permissions, that should be possible.

I think you need to read up and better understand Linux administration,
especially with regard to permissions, users and groups.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768
Next Topic: Verifying time in php
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 19:32:40 GMT 2024

Total time taken to generate the page: 0.04693 seconds