Jump to content

Implications of CURLOPT_FOLLOWLOCATION for Amazon S3


Jonob

Recommended Posts

I am using a curl library to upload images to Amazon S3 using a php wrapper (http://undesigned.org.za/2007/10/22/amazon-s3-php-class).

 

However, becuse CURLOPT_FOLLOWLOCATION is set to true on my server and open_basedir is enabled, this throws an error:

 

CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set

 

I understand that I could disable open_basedir or use one of the workarounds at http://php.net/manual/en/function.curl-setopt.php. Instead, as a quick test I set CURLOPT_FOLLOWLOCATION = false.

 

The image upload to S3 still seems to work, but I am concerned that something may break down the line. Are there any implications that I should be aware of? I am not quite if CURLOPT_FOLLOWLOCATION is it even relevant in this case?

Link to comment
Share on other sites

The CURLOPT_FOLLOWLOCATION option being set to true just tells cURL to follow redirects set by the server at the address being accessed. 

 

It's been a while since I've worked with Amazon S3 (I can barely remember it) but I'd think it's extremely unlikely that they would change the URL to which you post your data, and therefore possibly redirect you elsewhere.  Also, if they were to change the URL, I don't believe the post data would carry to the new page anyway - but I may be wrong or there may be ways to configure cURL to keep the post intact. 

 

This should be easy enough to test on your own server just by uploading one file that prints the $_POST array and another that redirects to it.  Then just post to the redirecting page via cURL and see what your result is.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.